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