static int hashCode(final @NonNull BinaryTypeDefinition type) { return Objects.hash(type.getPath(), type.getUnknownSchemaNodes(), type.getBaseType(), type.getUnits().orElse(null), type.getDefaultValue().orElse(null), type.getLengthConstraint().orElse(null)); }
@Override public boolean equals(final Object obj) { return BinaryTypeDefinition.equals(this, obj); } }
static boolean equals(final @NonNull BinaryTypeDefinition type, final @Nullable Object obj) { if (type == obj) { return true; } final BinaryTypeDefinition other = TypeDefinitions.castIfEquals(BinaryTypeDefinition.class, type, obj); return other != null && type.getLengthConstraint().equals(other.getLengthConstraint()); } }
final BinaryTypeDefinition base = binary.getBaseType(); if (base != null && base.getBaseType() != null) { length = currentOrEmpty(binary.getLengthConstraint(), base.getLengthConstraint()); } else { length = binary.getLengthConstraint();
private static BinaryTypeDefinition baseTypeIfNotConstrained(final @NonNull BinaryTypeDefinition type) { return baseTypeIfNotConstrained(type, type.getBaseType()); }
static boolean equals(final @NonNull BinaryTypeDefinition type, final @Nullable Object obj) { if (type == obj) { return true; } final BinaryTypeDefinition other = TypeDefinitions.castIfEquals(BinaryTypeDefinition.class, type, obj); return other != null && type.getLengthConstraint().equals(other.getLengthConstraint()); } }
final BinaryTypeDefinition base = binary.getBaseType(); if (base != null && base.getBaseType() != null) { length = currentOrEmpty(binary.getLengthConstraint(), base.getLengthConstraint()); } else { length = binary.getLengthConstraint();
private static BinaryTypeDefinition baseTypeIfNotConstrained(final @NonNull BinaryTypeDefinition type) { return baseTypeIfNotConstrained(type, type.getBaseType()); }
static int hashCode(final @NonNull BinaryTypeDefinition type) { return Objects.hash(type.getPath(), type.getUnknownSchemaNodes(), type.getBaseType(), type.getUnits().orElse(null), type.getDefaultValue().orElse(null), type.getLengthConstraint().orElse(null)); }
public static BinaryStringCodec from(final BinaryTypeDefinition type) { final java.util.Optional<LengthConstraint> optConstraint = type.getLengthConstraint(); return optConstraint.isPresent() ? new Restricted(type, optConstraint.get()) : new Unrestricted(type); }
@Override public boolean equals(final Object obj) { return BinaryTypeDefinition.equals(this, obj); }
static String toString(final @NonNull BinaryTypeDefinition type) { return TypeDefinitions.toStringHelper(type).add("length", type.getLengthConstraint().orElse(null)).toString(); }
@Override public boolean equals(final Object obj) { return BinaryTypeDefinition.equals(this, obj); } }
public static BinaryStringCodec from(final BinaryTypeDefinition type) { final java.util.Optional<LengthConstraint> optConstraint = type.getLengthConstraint(); return optConstraint.isPresent() ? new Restricted(type, optConstraint.get()) : new Unrestricted(type); }
@Override public boolean equals(final Object obj) { return BinaryTypeDefinition.equals(this, obj); }
static String toString(final @NonNull BinaryTypeDefinition type) { return TypeDefinitions.toStringHelper(type).add("length", type.getLengthConstraint().orElse(null)).toString(); }
@Override public boolean equals(final Object obj) { return BinaryTypeDefinition.equals(this, obj); }
private void emitTypeBodyNodes(final TypeDefinition<?> typeDef) { if (typeDef instanceof DecimalTypeDefinition) { emitDecimal64Specification((DecimalTypeDefinition) typeDef); } else if (typeDef instanceof RangeRestrictedTypeDefinition) { emitRangeRestrictedSpecification((RangeRestrictedTypeDefinition<?, ?>) typeDef); } else if (typeDef instanceof StringTypeDefinition) { emitStringRestrictions((StringTypeDefinition) typeDef); } else if (typeDef instanceof EnumTypeDefinition) { emitEnumSpecification((EnumTypeDefinition) typeDef); } else if (typeDef instanceof LeafrefTypeDefinition) { emitLeafrefSpecification((LeafrefTypeDefinition) typeDef); } else if (typeDef instanceof IdentityrefTypeDefinition) { emitIdentityrefSpecification((IdentityrefTypeDefinition) typeDef); } else if (typeDef instanceof InstanceIdentifierTypeDefinition) { emitInstanceIdentifierSpecification((InstanceIdentifierTypeDefinition) typeDef); } else if (typeDef instanceof BitsTypeDefinition) { emitBitsSpecification((BitsTypeDefinition) typeDef); } else if (typeDef instanceof UnionTypeDefinition) { emitUnionSpecification((UnionTypeDefinition) typeDef); } else if (typeDef instanceof BinaryTypeDefinition) { ((BinaryTypeDefinition) typeDef).getLengthConstraint().ifPresent(this::emitLength); } else if (typeDef instanceof BooleanTypeDefinition || typeDef instanceof EmptyTypeDefinition) { // NOOP } else { throw new IllegalArgumentException("Not supported type " + typeDef.getClass()); } }
@Override public boolean equals(final Object obj) { return BinaryTypeDefinition.equals(this, obj); }