use of ca.uhn.hl7v2.model.GenericComposite in project tdi-studio-se by Talend.
the class TypeModel method getComponent.
private Type getComponent(Type type, int comp) {
Type ret = null;
if (Varies.class.isAssignableFrom(type.getClass())) {
Varies v = (Varies) type;
try {
if (comp > 1 && GenericPrimitive.class.isAssignableFrom(v.getData().getClass())) {
v.setData(new GenericComposite(v.getMessage()));
}
} catch (DataTypeException de) {
String message = "Unexpected exception copying data to generic composite: " + de.getMessage();
throw new Error(message);
}
ret = getComponent(v.getData(), comp);
} else {
if (Primitive.class.isAssignableFrom(type.getClass()) && comp == 1) {
ret = type;
} else if (GenericComposite.class.isAssignableFrom(type.getClass()) || (Composite.class.isAssignableFrom(type.getClass()) && comp <= numStandardComponents(type))) {
try {
ret = ((Composite) type).getComponent(comp - 1);
} catch (Exception e) {
throw new Error("Internal error: HL7Exception thrown on getComponent(x) where x < # standard components.", e);
}
} else {
ret = type.getExtraComponents().getComponent(comp - numStandardComponents(type) - 1);
}
}
return ret;
}
Aggregations