View Javadoc

    1   /*
    2    * joey-gen and its relative products are published under the terms
    3    * of the Apache Software License.
    4    *
    5    * Created on 2005/02/27 1:31:17
    6    */
    7   package org.asyrinx.joey.gen.hibernate;
    8
    9   import java.util.List;
    10
    11  import org.apache.commons.lang.enum.Enum;
    12
    13  /***
    14   * @author takeshi
    15   */
    16  public class Cascade extends Enum {
    17
    18      /***
    19       * @param name
    20       */
    21      protected Cascade(String name) {
    22          super(name);
    23      }
    24
    25      public static final Cascade ALL = new Cascade("all");
    26
    27      public static final Cascade NONE = new Cascade("none");
    28
    29      public static final Cascade SAVE_UPDATE = new Cascade("save-update");
    30
    31      public static final Cascade DELETE = new Cascade("delete");
    32
    33      public static final Cascade ALL_DELETE_ORPHAN = new Cascade("all-delete-orphan");
    34
    35      //all, none, save-update, delete, all-delete-orphan
    36      public static final Cascade[] CASCADES = new Cascade[] { NONE, DELETE, SAVE_UPDATE, ALL,
    37              ALL_DELETE_ORPHAN };
    38
    39      public String getNameInToOne() {
    40          return NONE.getName();
    41      }
    42
    43      public String getNameInToMany() {
    44          return this.getName();
    45      }
    46
    47      public static Cascade get(String name) {
    48          return (Cascade) Enum.getEnum(Cascade.class, name);
    49      }
    50
    51      public static List getList() {
    52          return Enum.getEnumList(Cascade.class);
    53      }
    54
    55  }