001: package com.metaboss.sdlctools.models.metabossmodel.enterprisemodel;
002:
003: /**
004: * TransactionPolicy enumeration class implementation.
005: */
006: public final class TransactionPolicyEnum implements TransactionPolicy {
007: /**
008: * Enumeration constant corresponding to literal Never.
009: */
010: public static final TransactionPolicyEnum NEVER = new TransactionPolicyEnum(
011: "Never");
012: /**
013: * Enumeration constant corresponding to literal NotSupported.
014: */
015: public static final TransactionPolicyEnum NOT_SUPPORTED = new TransactionPolicyEnum(
016: "NotSupported");
017: /**
018: * Enumeration constant corresponding to literal Supported.
019: */
020: public static final TransactionPolicyEnum SUPPORTED = new TransactionPolicyEnum(
021: "Supported");
022: /**
023: * Enumeration constant corresponding to literal Required.
024: */
025: public static final TransactionPolicyEnum REQUIRED = new TransactionPolicyEnum(
026: "Required");
027: /**
028: * Enumeration constant corresponding to literal RequiredNew.
029: */
030: public static final TransactionPolicyEnum REQUIRED_NEW = new TransactionPolicyEnum(
031: "RequiredNew");
032: /**
033: * Enumeration constant corresponding to literal Mandatory.
034: */
035: public static final TransactionPolicyEnum MANDATORY = new TransactionPolicyEnum(
036: "Mandatory");
037:
038: private static final java.util.List typeName;
039: private final java.lang.String literalName;
040:
041: static {
042: java.util.ArrayList temp = new java.util.ArrayList();
043: temp.add("MetaBossModel");
044: temp.add("EnterpriseModel");
045: temp.add("TransactionPolicy");
046: typeName = java.util.Collections.unmodifiableList(temp);
047: }
048:
049: private TransactionPolicyEnum(java.lang.String literalName) {
050: this .literalName = literalName;
051: }
052:
053: /**
054: * Returns fully qualified name of the enumeration type.
055: * @return List containing all parts of the fully qualified name.
056: */
057: public java.util.List refTypeName() {
058: return typeName;
059: }
060:
061: /**
062: * Returns a string representation of the enumeration value.
063: * @return A string representation of the enumeration value.
064: */
065: public java.lang.String toString() {
066: return literalName;
067: }
068:
069: /**
070: * Returns a hash code for this the enumeration value.
071: * @return A hash code for this enumeration value.
072: */
073: public int hashCode() {
074: return literalName.hashCode();
075: }
076:
077: /**
078: * Indicates whether some other object is equal to this enumeration value.
079: * @param o The reference object with which to compare.
080: * @return true if the other object is the enumeration of the same type and
081: * of the same value.
082: */
083: public boolean equals(java.lang.Object o) {
084: if (o instanceof TransactionPolicyEnum)
085: return (o == this );
086: else if (o instanceof TransactionPolicy)
087: return (o.toString().equals(literalName));
088: else
089: return ((o instanceof javax.jmi.reflect.RefEnum)
090: && ((javax.jmi.reflect.RefEnum) o).refTypeName()
091: .equals(typeName) && o.toString().equals(
092: literalName));
093: }
094:
095: /**
096: * Translates literal name to correspondent enumeration value.
097: * @param name Enumeration literal.
098: * @return Enumeration value corresponding to the passed literal.
099: */
100: public static TransactionPolicy forName(java.lang.String name) {
101: if (name.equals("Never"))
102: return NEVER;
103: if (name.equals("NotSupported"))
104: return NOT_SUPPORTED;
105: if (name.equals("Supported"))
106: return SUPPORTED;
107: if (name.equals("Required"))
108: return REQUIRED;
109: if (name.equals("RequiredNew"))
110: return REQUIRED_NEW;
111: if (name.equals("Mandatory"))
112: return MANDATORY;
113: throw new java.lang.IllegalArgumentException(
114: "Unknown literal name '"
115: + name
116: + "' for enumeration 'MetaBossModel.EnterpriseModel.TransactionPolicy'");
117: }
118:
119: /**
120: * Resolves serialized instance of enumeration value.
121: * @return Resolved enumeration value.
122: */
123: protected java.lang.Object readResolve()
124: throws java.io.ObjectStreamException {
125: try {
126: return forName(literalName);
127: } catch (java.lang.IllegalArgumentException e) {
128: throw new java.io.InvalidObjectException(e.getMessage());
129: }
130: }
131: }
|