static boolean equals(final @NonNull IdentityrefTypeDefinition type, final @Nullable Object obj) { if (type == obj) { return true; } final IdentityrefTypeDefinition other = TypeDefinitions.castIfEquals(IdentityrefTypeDefinition.class, type, obj); return other != null && type.getIdentities().equals(other.getIdentities()); }
static boolean equals(final @NonNull IdentityrefTypeDefinition type, final @Nullable Object obj) { if (type == obj) { return true; } final IdentityrefTypeDefinition other = TypeDefinitions.castIfEquals(IdentityrefTypeDefinition.class, type, obj); return other != null && type.getIdentities().equals(other.getIdentities()); }
@Override public Set<IdentitySchemaNode> getIdentities() { return getBaseType().getIdentities(); }
@Override public Set<IdentitySchemaNode> getIdentities() { return getBaseType().getIdentities(); }
@Override public Set<IdentitySchemaNode> getIdentities() { return baseType().getIdentities(); }
@Override public Set<IdentitySchemaNode> getIdentities() { return baseType().getIdentities(); }
private void emitIdentityrefSpecification(final IdentityrefTypeDefinition typeDefinition) { emitBaseIdentities(typeDefinition.getIdentities()); }
static String toString(final @NonNull IdentityrefTypeDefinition type) { return TypeDefinitions.toStringHelper(type).add("identities", type.getIdentities()).toString(); } }
static String toString(final @NonNull IdentityrefTypeDefinition type) { return TypeDefinitions.toStringHelper(type).add("identities", type.getIdentities()).toString(); } }
static int hashCode(final @NonNull IdentityrefTypeDefinition type) { return Objects.hash(type.getPath(), type.getUnknownSchemaNodes(), type.getBaseType(), type.getUnits().orElse(null), type.getDefaultValue().orElse(null), type.getIdentities()); }
static int hashCode(final @NonNull IdentityrefTypeDefinition type) { return Objects.hash(type.getPath(), type.getUnknownSchemaNodes(), type.getBaseType(), type.getUnits().orElse(null), type.getDefaultValue().orElse(null), type.getIdentities()); }
/** * Seeks for identity reference <code>idref</code> the JAVA <code>type</code>. * * <p> * <i>Example:<br /> * If identy which is referenced via <code>idref</code> has name <b>Idn</b> * then returning type is <b>{@code Class<? extends Idn>}</b></i> * * @param idref identityref type definition for which JAVA <code>Type</code> is sought * @return JAVA <code>Type</code> of the identity which is referenced through <code>idref</code> */ private Type provideTypeForIdentityref(final IdentityrefTypeDefinition idref) { final Collection<IdentitySchemaNode> identities = idref.getIdentities(); if (identities.size() > 1) { LOG.warn("Identity reference {} has multiple identities, using only the first one", idref); } final QName baseIdQName = identities.iterator().next().getQName(); final Module module = schemaContext.findModule(baseIdQName.getModule()).orElse(null); IdentitySchemaNode identity = null; for (IdentitySchemaNode id : module.getIdentities()) { if (id.getQName().equals(baseIdQName)) { identity = id; } } Preconditions.checkArgument(identity != null, "Target identity '" + baseIdQName + "' do not exists"); final String basePackageName = BindingMapping.getRootPackageName(module.getQNameModule()); final JavaTypeName identifier = JavaTypeName.create(BindingGeneratorUtil.packageNameForGeneratedType( basePackageName, identity.getPath()), BindingMapping.getClassName(identity.getQName())); return Types.classType(Types.wildcardTypeFor(identifier)); }