|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.uhn.hl7v2.model.AbstractStructure
ca.uhn.hl7v2.model.AbstractGroup
public abstract class AbstractGroup
A partial implementation of Group. Subclasses correspond to specific groups of segments (and/or other sub-groups) that are implicitly defined by message structures in the HL7 specification. A subclass should define it's group structure by putting repeated calls to the add(...) method in it's constructor. Each call to add(...) adds a specific component to the Group.
| Field Summary |
|---|
| Fields inherited from class ca.uhn.hl7v2.model.AbstractStructure |
|---|
log |
| Constructor Summary | |
|---|---|
protected |
AbstractGroup(Group parent,
ModelClassFactory factory)
This constructor should be used by implementing classes that do not also implement Message. |
| Method Summary | ||
|---|---|---|
protected String |
add(Class<? extends Structure> c,
boolean required,
boolean repeating)
Adds a new Structure (group or segment) to this Group. |
|
protected String |
add(Class<? extends Structure> c,
boolean required,
boolean repeating,
int index)
Adds a new Structure (group or segment) to this Group. |
|
String |
addNonstandardSegment(String name)
Expands the group definition to include a segment that is not defined by HL7 to be part of this group (eg an unregistered Z segment). |
|
String |
addNonstandardSegment(String theName,
int theIndex)
Expands the group definition to include a segment that is not defined by HL7 to be part of this group (eg an unregistered Z segment). |
|
void |
clear()
Clears all data from this structure. |
|
int |
currentReps(String name)
Returns the number of existing repetitions of the named structure. |
|
Structure |
get(String name)
Returns the named structure. |
|
Structure |
get(String name,
int rep)
Returns a particular repetition of the named Structure. |
|
Structure[] |
getAll(String name)
Returns an array of Structure objects by name. |
|
protected
|
getAllAsList(String name,
Class<T> theType)
Returns a list containing all existing repetitions of the structure identified by name |
|
Class<? extends Structure> |
getClass(String name)
Returns the Class of the Structure at the given name index. |
|
int |
getFieldNumForName(String name)
Given a child structure name, returns the child index (which is 1-indexed, meaning that the first child is at index 1 |
|
ModelClassFactory |
getModelClassFactory()
Returns the ModelClassFactory associated with this structure |
|
String |
getName()
Returns the class name (excluding package). |
|
String[] |
getNames()
Returns an ordered array of the names of the Structures in this Group. |
|
Set<String> |
getNonStandardNames()
Returns a Set containing the names of all non-standard structures which have been added to this structure |
|
protected int |
getReps(String name)
|
|
protected
|
getTyped(String name,
Class<T> type)
|
|
protected
|
getTyped(String name,
int rep,
Class<T> type)
|
|
protected String |
insert(Class<? extends Structure> c,
boolean required,
boolean repeating,
int index,
String name)
Inserts the given structure into this group, at the indicated index number. |
|
Structure |
insertRepetition(String name,
int index)
Inserts a repetition of a given Structure into repetitions of that structure by name. |
|
protected void |
insertRepetition(String name,
Structure structure,
int index)
Inserts a repetition of a given Structure into repetitions of that structure by name. |
|
boolean |
isGroup(String name)
Returns true if the named structure is a group |
|
boolean |
isRepeating(String name)
Returns true if the named structure is required. |
|
boolean |
isRequired(String name)
Returns true if the named structure is required. |
|
Structure |
removeRepetition(String name,
int index)
Removes a repetition of a given Structure objects by name. |
|
protected Structure |
tryToInstantiateStructure(Class<? extends Structure> c,
String name)
Attempts to create an instance of the given class and return it as a Structure. |
|
| Methods inherited from class ca.uhn.hl7v2.model.AbstractStructure |
|---|
getMessage, getParent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ca.uhn.hl7v2.model.Structure |
|---|
getMessage, getParent |
| Constructor Detail |
|---|
protected AbstractGroup(Group parent,
ModelClassFactory factory)
parent - the group to which this Group belongs.factory - the factory for classes of segments, groups, and datatypes
under this group| Method Detail |
|---|
public Structure get(String name)
throws HL7Exception
get in interface GroupHL7Exception - if the named Structure is not part of this Group.
protected <T extends Structure> T getTyped(String name,
Class<T> type)
public Structure get(String name,
int rep)
throws HL7Exception
get in interface GroupHL7Exception - if the named Structure is not part of this group, if the
structure is not repeatable and the given rep is > 0, or if
the given repetition number is more than one greater than the
existing number of repetitions.
protected <T extends Structure> T getTyped(String name,
int rep,
Class<T> type)
protected int getReps(String name)
public String addNonstandardSegment(String name)
throws HL7Exception
addNonstandardSegment in interface GroupHL7Exception
public String addNonstandardSegment(String theName,
int theIndex)
throws HL7Exception
Group
addNonstandardSegment in interface GroupHL7Exceptionpublic Set<String> getNonStandardNames()
public String[] getNames()
get(name).
getNames in interface Group
protected String add(Class<? extends Structure> c,
boolean required,
boolean repeating)
throws HL7Exception
HL7Exception
protected String add(Class<? extends Structure> c,
boolean required,
boolean repeating,
int index)
throws HL7Exception
HL7Exception
protected Structure tryToInstantiateStructure(Class<? extends Structure> c,
String name)
throws HL7Exception
c - the Structure implementing classname - an optional name of the structure (used by Generic structures;
may be null)
HL7Exception
public boolean isGroup(String name)
throws HL7Exception
isGroup in interface GroupHL7Exception
public boolean isRequired(String name)
throws HL7Exception
isRequired in interface GroupHL7Exception
public boolean isRepeating(String name)
throws HL7Exception
isRepeating in interface GroupHL7Exception
public int currentReps(String name)
throws HL7Exception
HL7Exception
public Structure[] getAll(String name)
throws HL7Exception
getAll in interface GroupHL7Exception - if the named Structure is not part of this Group.
protected <T extends Structure> List<T> getAllAsList(String name,
Class<T> theType)
throws HL7Exception
HL7Exception - if the named Structure is not part of this Group.
public Structure removeRepetition(String name,
int index)
throws HL7Exception
HL7Exception - if the named Structure is not part of this Group.
protected void insertRepetition(String name,
Structure structure,
int index)
throws HL7Exception
HL7Exception - if the named Structure is not part of this Group.
public Structure insertRepetition(String name,
int index)
throws HL7Exception
HL7Exception - if the named Structure is not part of this Group.
public int getFieldNumForName(String name)
throws HL7Exception
HL7Exceptionpublic Class<? extends Structure> getClass(String name)
getClass in interface Grouppublic String getName()
getName in interface StructureStructure.getName()
protected String insert(Class<? extends Structure> c,
boolean required,
boolean repeating,
int index,
String name)
throws HL7Exception
HL7Exceptionpublic void clear()
public final ModelClassFactory getModelClassFactory()
ModelClassFactory associated with this structure
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||