Fields Summary |
---|
private final String | nameStores the external name of this instance, by which it can be retrieved. |
private final String | descriptionStores the human-readable description of this instance, by which it is
identified in the user interface. |
private final int | codeStores the integer value used by Hibernate to persist this instance. |
private static final Map | instancesByNameKeeps track of all instances by name, for efficient lookup. |
private static final Map | instancesByCodeKeeps track of all instances by code, for efficient lookup. |
public static final SourceMedia | CASSETTEThe instance that represents music obtained from cassette tape. |
public static final SourceMedia | VINYLThe instance that represents music obtained from vinyl. |
public static final SourceMedia | VHSThe instance that represents music obtained from VHS tapes. |
public static final SourceMedia | BROADCASTThe instance that represents music obtained from a broadcast. |
public static final SourceMedia | CDThe instance that represents music obtained from a compact disc. |
public static final SourceMedia | DOWNLOADThe instance that represents music obtained as an Internet download. |
public static final SourceMedia | STREAMThe instance that represents music from a digital audio stream. |
Methods Summary |
---|
public static com.oreilly.hh.SourceMedia | fromInt(int code)Look up an instance by code, as specified by the {@link PersistentEnum}
interface.
SourceMedia result =
(SourceMedia)instancesByCode.get(new Integer(code));
if (result == null) {
throw new NoSuchElementException("code=" + code);
}
return result;
|
public static java.util.Collection | getAllValues()Obtain the collection of all legal enumeration values.
return Collections.unmodifiableCollection(instancesByName.values());
|
public java.lang.String | getDescription()Return the description associated with this instance.
return description;
|
public static com.oreilly.hh.SourceMedia | getInstanceByName(java.lang.String name)Look up an instance by name.
SourceMedia result = (SourceMedia)instancesByName.get(name);
if (result == null) {
throw new NoSuchElementException(name);
}
return result;
|
public java.lang.String | getName()Return the external name associated with this instance.
return name;
|
private java.lang.Object | readResolve()Insure that deserialization preserves the signleton property.
return getInstanceByName(name);
|
public int | toInt()Return the persistence code associated with this instance, as
mandated by the {@link PersistentEnum} interface.
return code;
|
public java.lang.String | toString()Return a string representation of this object.
return description;
|