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