boolean nonPreferred = false; if (IBaseResource.class.isAssignableFrom(next)) { elementName = getElementName() + StringUtils.capitalize(next.getSimpleName()); List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>(); types.add((Class<? extends IBaseResource>) next); nextDef = findResourceReferenceDefinition(theClassToElementDefinitions); myNameToChildDefinition.put(getElementName() + "Reference", nextDef); myNameToChildDefinition.put(getElementName() + "Resource", nextDef); Class<? extends IBaseDatatype> profileType = nextDefDatatype.getProfileOf(); BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(profileType); elementName = getElementName() + StringUtils.capitalize(elementDef.getName()); elementName = getElementName() + StringUtils.capitalize(nextDefForChoice.getName()); elementName = getElementName() + myReferenceSuffix; myNameToChildDefinition.put(elementName, nextDef); String existing = myDatatypeToElementName.get(next); if (!existing.equals(elementName)) { throw new ConfigurationException("Already have element name " + existing + " for datatype " + next.getSimpleName() + " in " + getElementName() + ", cannot add " + elementName);
@Override public BaseRuntimeElementDefinition<?> getChildByName(String theName) { String name = theName; if ("extension".equals(name)||"modifierExtension".equals(name)) { if (myChildResourceBlock != null) { return myChildResourceBlock; } if (myChildDef != null) { return myChildDef; } } if (getValidChildNames().contains(name) == false) { return null; } return super.getChildByName(name); }
@Override public String getChildNameByDatatype(Class<? extends IBase> theDatatype) { String retVal = super.getChildNameByDatatype(theDatatype); if (retVal != null) { BaseRuntimeElementDefinition<?> childDef = super.getChildElementDefinitionByDatatype(theDatatype); if (childDef instanceof RuntimeResourceBlockDefinition) { // Child is a newted extension retVal = null; } } if (retVal == null) { if (myModifier) { return "modifierExtension"; } return "extension"; } return retVal; }
super.sealAndInitialize(theContext, theClassToElementDefinitions);
@Override public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theDatatype) { if (myChildResourceBlock != null) { if (myChildResourceBlock.getImplementingClass().equals(theDatatype)) { return myChildResourceBlock; } } return super.getChildElementDefinitionByDatatype(theDatatype); }
protected void throwExceptionForUnknownChildType(BaseRuntimeChildDefinition nextChild, Class<? extends IBase> theType) { if (nextChild instanceof BaseRuntimeDeclaredChildDefinition) { StringBuilder b = new StringBuilder(); b.append(nextChild.getElementName()); b.append(" has type "); b.append(theType.getName()); b.append(" but this is not a valid type for this element"); if (nextChild instanceof RuntimeChildChoiceDefinition) { RuntimeChildChoiceDefinition choice = (RuntimeChildChoiceDefinition) nextChild; b.append(" - Expected one of: " + choice.getValidChildTypes()); } throw new DataFormatException(b.toString()); } throw new DataFormatException(nextChild + " has no child of type " + theType); }
childIsChoiceType |= choiceTypes.size() > 1; if (extensionAttr == null && childIsChoiceType && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) && !IBaseReference.class.isAssignableFrom(nextElementType)) { def = new RuntimeChildChoiceDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, choiceTypes); } else if (extensionAttr != null) {
if (def instanceof RuntimeChildChoiceDefinition) { RuntimeChildChoiceDefinition choiceDef = (RuntimeChildChoiceDefinition) def; resourceTypes.addAll(choiceDef.getResourceTypes()); } else if (def instanceof RuntimeChildResourceDefinition) { RuntimeChildResourceDefinition resDef = (RuntimeChildResourceDefinition) def;
super.sealAndInitialize(theContext, theClassToElementDefinitions);
@Override public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theDatatype) { if (myChildResourceBlock != null) { if (myChildResourceBlock.getImplementingClass().equals(theDatatype)) { return myChildResourceBlock; } } return super.getChildElementDefinitionByDatatype(theDatatype); }
protected void throwExceptionForUnknownChildType(BaseRuntimeChildDefinition nextChild, Class<? extends IBase> theType) { if (nextChild instanceof BaseRuntimeDeclaredChildDefinition) { StringBuilder b = new StringBuilder(); b.append(nextChild.getElementName()); b.append(" has type "); b.append(theType.getName()); b.append(" but this is not a valid type for this element"); if (nextChild instanceof RuntimeChildChoiceDefinition) { RuntimeChildChoiceDefinition choice = (RuntimeChildChoiceDefinition) nextChild; b.append(" - Expected one of: " + choice.getValidChildTypes()); } throw new DataFormatException(b.toString()); } throw new DataFormatException(nextChild + " has no child of type " + theType); }
childIsChoiceType |= choiceTypes.size() > 1; if (extensionAttr == null && childIsChoiceType && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) && !IBaseReference.class.isAssignableFrom(nextElementType)) { def = new RuntimeChildChoiceDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, choiceTypes); } else if (extensionAttr != null) {
if (def instanceof RuntimeChildChoiceDefinition) { RuntimeChildChoiceDefinition choiceDef = (RuntimeChildChoiceDefinition) def; resourceTypes.addAll(choiceDef.getResourceTypes()); } else if (def instanceof RuntimeChildResourceDefinition) { RuntimeChildResourceDefinition resDef = (RuntimeChildResourceDefinition) def;
@Override public String getChildNameByDatatype(Class<? extends IBase> theDatatype) { String retVal = super.getChildNameByDatatype(theDatatype); if (retVal != null) { BaseRuntimeElementDefinition<?> childDef = super.getChildElementDefinitionByDatatype(theDatatype); if (childDef instanceof RuntimeResourceBlockDefinition) { // Child is a newted extension retVal = null; } } if (retVal == null) { if (myModifier) { return "modifierExtension"; } return "extension"; } return retVal; }
boolean nonPreferred = false; if (IBaseResource.class.isAssignableFrom(next)) { elementName = getElementName() + StringUtils.capitalize(next.getSimpleName()); List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>(); types.add((Class<? extends IBaseResource>) next); nextDef = findResourceReferenceDefinition(theClassToElementDefinitions); myNameToChildDefinition.put(getElementName() + "Reference", nextDef); myNameToChildDefinition.put(getElementName() + "Resource", nextDef); Class<? extends IBaseDatatype> profileType = nextDefDatatype.getProfileOf(); BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(profileType); elementName = getElementName() + StringUtils.capitalize(elementDef.getName()); elementName = getElementName() + StringUtils.capitalize(nextDefForChoice.getName()); elementName = getElementName() + myReferenceSuffix; myNameToChildDefinition.put(elementName, nextDef); String existing = myDatatypeToElementName.get(next); if (!existing.equals(elementName)) { throw new ConfigurationException("Already have element name " + existing + " for datatype " + next.getSimpleName() + " in " + getElementName() + ", cannot add " + elementName);
super.sealAndInitialize(theContext, theClassToElementDefinitions);
@Override public BaseRuntimeElementDefinition<?> getChildByName(String theName) { String name = theName; if ("extension".equals(name)||"modifierExtension".equals(name)) { if (myChildResourceBlock != null) { return myChildResourceBlock; } if (myChildDef != null) { return myChildDef; } } if (getValidChildNames().contains(name) == false) { return null; } return super.getChildByName(name); }
super.sealAndInitialize(theContext, theClassToElementDefinitions);