public static String getGetterMethodName(final TypedDataSchemaNode node) { // Bug 8903: If it is a derived type of boolean or empty, not an inner type, then the return type // of method would be the generated type of typedef not build-in types, so here it should be 'get'. final TypeDefinition<?> type = node.getType(); return BindingMapping.getGetterMethodName(node.getQName(), (type instanceof BooleanTypeDefinition || type instanceof EmptyTypeDefinition) && (type.getPath().equals(node.getPath()) || type.getBaseType() == null)); } }
private T createComplexCodecFor(final TypedDataSchemaNode schema, final TypeDefinition<?> type) { if (type instanceof UnionTypeDefinition) { return createComplexUnion(schema, (UnionTypeDefinition) type); } else if (type instanceof LeafrefTypeDefinition) { final TypeDefinition<?> target = SchemaContextUtil.getBaseTypeForLeafRef((LeafrefTypeDefinition) type, schemaContext, schema); verifyNotNull(target, "Unable to find base type for leafref node %s type %s.", schema.getPath(), target); final T ret = getSimpleCodecFor(target); return ret != null ? ret : createComplexCodecFor(schema, target); } else if (type instanceof IdentityrefTypeDefinition) { return identityRefCodec((IdentityrefTypeDefinition) type, schema.getQName().getModule()); } else { throw new IllegalArgumentException("Unsupported type " + type); } }
private T createComplexCodecFor(final TypedDataSchemaNode schema, final TypeDefinition<?> type) { if (type instanceof UnionTypeDefinition) { return createComplexUnion(schema, (UnionTypeDefinition) type); } else if (type instanceof LeafrefTypeDefinition) { final TypeDefinition<?> target = SchemaContextUtil.getBaseTypeForLeafRef((LeafrefTypeDefinition) type, schemaContext, schema); verifyNotNull(target, "Unable to find base type for leafref node %s type %s.", schema.getPath(), target); final T ret = getSimpleCodecFor(target); return ret != null ? ret : createComplexCodecFor(schema, target); } else if (type instanceof IdentityrefTypeDefinition) { return identityRefCodec((IdentityrefTypeDefinition) type, schema.getQName().getModule()); } else { throw new IllegalArgumentException("Unsupported type " + type); } }