ca.infoway.messagebuilder.lang
Class EnumPattern

Package class diagram package EnumPattern
java.lang.Object
  extended by ca.infoway.messagebuilder.lang.Enum
      extended by ca.infoway.messagebuilder.lang.EnumPattern
All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
AcknowledgementCondition, AcknowledgementDetailCode, AcknowledgementDetailType, AcknowledgementType, ActClass, ActCode, ActConsentInformationAccessReason, ActDetectedIssueCode, ActIssuePriority, ActMood, ActPharmacySupplyType, ActReason, ActRelationshipSubset, ActSpecimenTransportationCode, ActStatus, ActSubstanceAdministrationImmunizationCode, ActSubstanceAdministrationImmunizationType, AdministrativeGender, AnnotationType, CodeSystem, CodingStrength, Compression, Confidentiality, ConformanceLevel, Currency, DefaultTimeUnit, DomainSource, EntityNameUse, HL7StandardVersionCode, HL7TriggerEventCode, Iso3166Alpha2Country, IssueFilterCode, MediaType, MessageWaitingPriority, NullFlavor, OrganizationNamePartType, ParticipationMode, PersonNamePartType, PostalAddressPartType, PostalAddressUse, ProbabilityMatchCode, ProcessingID, ProcessingMode, QuantityRequestLimit, QueryResponse, ResponseMode, RimClass, RoleClass, RoleCode, RoleStatus, RoleStatusNormal, SCTEMP, SetOperator, SeverityObservation, SpecificationVersion, SpecimenRoleType, StandardDataType, SubscriptionStatus, TelecommunicationAddressUse, TopicPriority, TriggerEventId, UnitsOfMeasureCaseSensitive, UpdateModeType, URLScheme, x_ActMoodIntentEvent, x_ActMoodOrderEvent, X_BasicPostalAddressUse, X_DistanceObservationUnitsOfMeasure, X_DocumentMediaType, X_DrugUnitsOfMeasure, X_HeightOrWeightObservationUnitsOfMeasure

public class EnumPattern
extends Enum

A class that implements an Enum Pattern. While Java 1.5 has enums, enums that implement an interface and/or contain behaviour do not have a direct counterpart in .Net. In order to keep the two codebases as consistent as possible our code makes use of this Enum Pattern where applicable. Code should not call Class.isEnum(), instead they should use EnumPattern.isEnum(Class).

Author:
Intelliware Development
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ca.infoway.messagebuilder.lang.Enum
INNER_CLASS_SEPARATOR_CHAR, iToString, PACKAGE_SEPARATOR_CHAR
 
Constructor Summary
protected EnumPattern(String name)
           
 
Method Summary
static Object[] getEnumConstants(Class<?> enumClass)
          Gets the enum constants for a given enum (java-based or enum pattern-based).
static boolean isEnum(Class<?> enumClass)
          Checks if is an enum (java-based or enum pattern-based).
 String name()
          Gets the unique string identififying this particular enum.
 String toString()
          Human readable description of this Enum item.
static
<T> T
valueOf(Class<T> enumClass, String name)
          Obtains the enum value of a given string.
static
<T> List<T>
values(Class<T> enumClass)
          Returns the enum values for a given enum class.
 
Methods inherited from class ca.infoway.messagebuilder.lang.Enum
compareTo, equals, getEnum, getEnumClass, getEnumList, getEnumMap, getName, getShortClassName, getShortClassName, hashCode, iterator, readResolve
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumPattern

protected EnumPattern(String name)
Method Detail

name

public String name()

Gets the unique string identififying this particular enum.

Returns:
the unique string identififying this particular enum.

valueOf

public static <T> T valueOf(Class<T> enumClass,
                            String name)

Obtains the enum value of a given string.

Type Parameters:
T - the generic type
Parameters:
enumClass - the enum class
name - the enum name
Returns:
the enum representing the name value

values

public static <T> List<T> values(Class<T> enumClass)

Returns the enum values for a given enum class.

Type Parameters:
T - the generic type
Parameters:
enumClass - the enum class
Returns:
the list

getEnumConstants

public static Object[] getEnumConstants(Class<?> enumClass)

Gets the enum constants for a given enum (java-based or enum pattern-based).

Parameters:
enumClass - the enum class
Returns:
the enum constants

isEnum

public static boolean isEnum(Class<?> enumClass)

Checks if is an enum (java-based or enum pattern-based).

Parameters:
enumClass - the enum class
Returns:
true, if is enum

toString

public String toString()

Human readable description of this Enum item.

Overrides:
toString in class Enum
Returns:
String in the form type[name], for example: Color[Red]. Note that the package name is stripped from the type name.


Copyright © 2013. All Rights Reserved.