/** * {@inheritDoc } */ public Class<? extends Segment> getSegmentClass(String name, String version) throws HL7Exception { String key = "segment" + name + version; Class<? extends Segment> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("segment", name, version); if (retVal == null) { retVal = delegate.getSegmentClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
/** * {@inheritDoc } */ public Class<? extends Segment> getSegmentClass(String name, String version) throws HL7Exception { String key = "segment" + name + version; Class<? extends Segment> retVal = cache.get(key); if (retVal != null) return retVal; retVal = findClass("segment", name, version); if (retVal == null) { retVal = delegate.getSegmentClass(name, version); } if (retVal != null) cache.putIfAbsent(key, retVal); return retVal; }
c = factory.getSegmentClass("MSH", version);
c = factory.getSegmentClass("MSH", version);
public String addNonstandardSegment(String theName, int theIndex) throws HL7Exception { if (this instanceof Message && theIndex == 0) { throw new HL7Exception("Can not add nonstandard segment \"" + theName + "\" to start of message."); } String version = this.getMessage().getVersion(); if (version == null) throw new HL7Exception("Need message version to add segment by name; message.getVersion() returns null"); Class<? extends Segment> c = myFactory.getSegmentClass(theName, version); if (c == null) { c = GenericSegment.class; } tryToInstantiateStructure(c, theName); // may throw exception String newName = insert(c, false, true, theIndex, theName); if (this.nonStandardNames == null) { this.nonStandardNames = new HashSet<String>(); } this.nonStandardNames.add(newName); return newName; }
/** * 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). The new segment is slotted at the end of the * group. Thenceforward if such a segment is encountered it will be parsed into this location. * If the segment name is unrecognized a GenericSegment is used. The segment is defined as * repeating and not required. */ public String addNonstandardSegment(String name) throws HL7Exception { String version = this.getMessage().getVersion(); if (version == null) throw new HL7Exception("Need message version to add segment by name; message.getVersion() returns null"); Class<? extends Segment> c = myFactory.getSegmentClass(name, version); if (c == null) c = GenericSegment.class; int index = this.getNames().length; tryToInstantiateStructure(c, name); // may throw exception String newName = insert(c, false, true, index, name); if (this.nonStandardNames == null) { this.nonStandardNames = new HashSet<String>(); } this.nonStandardNames.add(newName); return newName; }
public String addNonstandardSegment(String theName, int theIndex) throws HL7Exception { if (this instanceof Message && theIndex == 0) { throw new HL7Exception("Can not add nonstandard segment \"" + theName + "\" to start of message."); } String version = this.getMessage().getVersion(); if (version == null) throw new HL7Exception("Need message version to add segment by name; message.getVersion() returns null"); Class<? extends Segment> c = myFactory.getSegmentClass(theName, version); if (c == null) { c = GenericSegment.class; } tryToInstantiateStructure(c, theName); // may throw exception String newName = insert(c, false, true, theIndex, theName); if (this.nonStandardNames == null) { this.nonStandardNames = new HashSet<String>(); } this.nonStandardNames.add(newName); return newName; }
/** * 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). The new segment is slotted at the end of the * group. Thenceforward if such a segment is encountered it will be parsed into this location. * If the segment name is unrecognized a GenericSegment is used. The segment is defined as * repeating and not required. */ public String addNonstandardSegment(String name) throws HL7Exception { String version = this.getMessage().getVersion(); if (version == null) throw new HL7Exception("Need message version to add segment by name; message.getVersion() returns null"); Class<? extends Segment> c = myFactory.getSegmentClass(name, version); if (c == null) c = GenericSegment.class; int index = this.getNames().length; tryToInstantiateStructure(c, name); // may throw exception String newName = insert(c, false, true, index, name); if (this.nonStandardNames == null) { this.nonStandardNames = new HashSet<String>(); } this.nonStandardNames.add(newName); return newName; }