private static <T extends SchemaNode> T getOriginalSchema(final T choice) { @SuppressWarnings("unchecked") final T original = (T) SchemaNodeUtils.getRootOriginalIfPossible(choice); if (original != null) { return original; } return choice; }
private static <T extends SchemaNode> T getOriginalSchema(final T choice) { @SuppressWarnings("unchecked") final T original = (T) SchemaNodeUtils.getRootOriginalIfPossible(choice); if (original != null) { return original; } return choice; }
private static final <T extends SchemaNode> T getOriginalSchema(final T choice) { @SuppressWarnings("unchecked") final T original = (T) SchemaNodeUtils.getRootOriginalIfPossible(choice); if (original != null) { return original; } return choice; }
public static Optional<CaseSchemaNode> findInstantiatedCase(final ChoiceSchemaNode instantiatedChoice, final CaseSchemaNode originalDefinition) { CaseSchemaNode potential = instantiatedChoice.getCaseNodeByName(originalDefinition.getQName()); if (originalDefinition.equals(potential)) { return Optional.of(potential); } if (potential != null) { SchemaNode potentialRoot = SchemaNodeUtils.getRootOriginalIfPossible(potential); if (originalDefinition.equals(potentialRoot)) { return Optional.of(potential); } } // We try to find case by name, then lookup its root definition // and compare it with original definition // This solves case, if choice was inside grouping // which was used in different module and thus namespaces are // different, but local names are still same. // // Still we need to check equality of definition, because local name is not // sufficient to uniquelly determine equality of cases // for (CaseSchemaNode caze : instantiatedChoice.findCaseNodes(originalDefinition.getQName().getLocalName())) { if (originalDefinition.equals(SchemaNodeUtils.getRootOriginalIfPossible(caze))) { return Optional.of(caze); } } return Optional.empty(); }
public static Optional<ChoiceCaseNode> findInstantiatedCase(final ChoiceSchemaNode instantiatedChoice, final ChoiceCaseNode originalDefinition) { ChoiceCaseNode potential = instantiatedChoice.getCaseNodeByName(originalDefinition.getQName()); if(originalDefinition.equals(potential)) { return Optional.of(potential); } if (potential != null) { SchemaNode potentialRoot = SchemaNodeUtils.getRootOriginalIfPossible(potential); if (originalDefinition.equals(potentialRoot)) { return Optional.of(potential); } } // We try to find case by name, then lookup its root definition // and compare it with original definition // This solves case, if choice was inside grouping // which was used in different module and thus namespaces are // different, but local names are still same. // // Still we need to check equality of definition, because local name is not // sufficient to uniquelly determine equality of cases // potential = instantiatedChoice.getCaseNodeByName(originalDefinition.getQName().getLocalName()); if(potential != null && (originalDefinition.equals(SchemaNodeUtils.getRootOriginalIfPossible(potential)))) { return Optional.of(potential); } return Optional.absent(); }
final SchemaNode potentialRoot = SchemaNodeUtils.getRootOriginalIfPossible(potential); if (originalDefinition.equals(potentialRoot)) { return Optional.of(potential); if (originalDefinition.equals(SchemaNodeUtils.getRootOriginalIfPossible(found))) { return Optional.of(found);
} else if (origDef.equals(SchemaNodeUtils.getRootOriginalIfPossible(sameName))) { childSchema = sameName; } else { if (potential != null && origDef.equals(SchemaNodeUtils.getRootOriginalIfPossible(potential))) { childSchema = potential; } else {
} else if (origDef.equals(SchemaNodeUtils.getRootOriginalIfPossible(sameName))) { childSchema = sameName; } else { if (potential != null && origDef.equals(SchemaNodeUtils.getRootOriginalIfPossible(potential))) { childSchema = potential; } else {
} else if (typeDef instanceof EnumTypeDefinition && BaseTypes.ENUMERATION_QNAME.equals(typeDef.getQName())) { LeafSchemaNode originalLeaf = (LeafSchemaNode) SchemaNodeUtils.getRootOriginalIfPossible(leaf); QName qname = originalLeaf.getQName(); final Module enumModule = schemaContext.findModuleByNamespaceAndRevision(qname.getNamespace(),
private boolean resolveLeafSchemaNodeAsProperty(final GeneratedTOBuilder toBuilder, final LeafSchemaNode leaf, final boolean isReadOnly) { if (leaf != null && toBuilder != null) { Type returnType; final TypeDefinition<?> typeDef = CompatUtils.compatLeafType(leaf); if (typeDef instanceof UnionTypeDefinition) { // GeneratedType for this type definition should have be already created final ModuleContext mc = moduleContext(typeDef.getQName().getModule()); returnType = mc.getTypedefs().get(typeDef.getPath()); if (returnType == null) { // This may still be an inner type, try to find it returnType = mc.getInnerType(typeDef.getPath()); } } else if (typeDef instanceof EnumTypeDefinition && typeDef.getBaseType() == null) { // Annonymous enumeration (already generated, since it is inherited via uses). LeafSchemaNode originalLeaf = (LeafSchemaNode) SchemaNodeUtils.getRootOriginalIfPossible(leaf); QName qname = originalLeaf.getQName(); returnType = moduleContext(qname.getModule()).getInnerType(originalLeaf.getType().getPath()); } else { returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, leaf); } return resolveLeafSchemaNodeAsProperty(toBuilder, leaf, returnType, isReadOnly); } return false; }