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