/** * Check if a particular type definition represents the built-in int32 type. * * @param type Type definition * @return True if the definition is the built-in int32 type. */ public static boolean isInt32(final TypeDefinition<?> type) { return BaseInt32Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type definition represents the built-in int16 type. * * @param type Type definition * @return True if the definition is the built-in int16 type. */ public static boolean isInt16(final TypeDefinition<?> type) { return BaseInt16Type.INSTANCE.getPath().equals(type.getPath()); }
static @NonNull ToStringHelper toStringHelper(final @NonNull TypeDefinition<?> type) { return MoreObjects.toStringHelper(type).omitNullValues() .add("path", type.getPath()) .add("baseType", type.getBaseType()) .add("default", type.getDefaultValue().orElse(null)) .add("description", type.getDescription().orElse(null)) .add("reference", type.getReference().orElse(null)) .add("status", type.getStatus()) .add("units", type.getUnits().orElse(null)); }
static @NonNull ToStringHelper toStringHelper(final @NonNull TypeDefinition<?> type) { return MoreObjects.toStringHelper(type).omitNullValues() .add("path", type.getPath()) .add("baseType", type.getBaseType()) .add("default", type.getDefaultValue().orElse(null)) .add("description", type.getDescription().orElse(null)) .add("reference", type.getReference().orElse(null)) .add("status", type.getStatus()) .add("units", type.getUnits().orElse(null)); }
/** * Check if a particular type definition represents the built-in int8 type. * * @param type Type definition * @return True if the definition is the built-in int8 type. */ public static boolean isInt8(final TypeDefinition<?> type) { return BaseInt8Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type definition represents the built-in int64 type. * * @param type Type definition * @return True if the definition is the built-in int64 type. */ public static boolean isInt64(final TypeDefinition<?> type) { return BaseInt64Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type definition represents the built-in int64 type. * * @param type Type definition * @return True if the definition is the built-in int64 type. */ public static boolean isInt64(final TypeDefinition<?> type) { return BaseInt64Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type definition represents the built-in int16 type. * * @param type Type definition * @return True if the definition is the built-in int16 type. */ public static boolean isInt16(final TypeDefinition<?> type) { return BaseInt16Type.INSTANCE.getPath().equals(type.getPath()); }
static <T extends TypeDefinition<T>> @Nullable T castIfEquals(final @NonNull Class<T> clazz, final @NonNull T type, final @Nullable Object obj) { if (!clazz.isInstance(obj)) { return null; } final @NonNull T other = clazz.cast(obj); return Objects.equals(type.getPath(), other.getPath()) && Objects.equals(type.getBaseType(), other.getBaseType()) && Objects.equals(type.getDefaultValue(), other.getDefaultValue()) && Objects.equals(type.getUnknownSchemaNodes(), other.getUnknownSchemaNodes()) && Objects.equals(type.getUnits(), other.getUnits()) ? other : null; }
static <T extends TypeDefinition<T>> @Nullable T castIfEquals(final @NonNull Class<T> clazz, final @NonNull T type, final @Nullable Object obj) { if (!clazz.isInstance(obj)) { return null; } final @NonNull T other = clazz.cast(obj); return Objects.equals(type.getPath(), other.getPath()) && Objects.equals(type.getBaseType(), other.getBaseType()) && Objects.equals(type.getDefaultValue(), other.getDefaultValue()) && Objects.equals(type.getUnknownSchemaNodes(), other.getUnknownSchemaNodes()) && Objects.equals(type.getUnits(), other.getUnits()) ? other : null; }
/** * Check if a particular type is the base type for uint16. * * @param type The type to check * @return If the type corresponds to the base uint16 type. * @throws NullPointerException if type is null */ public static boolean isUint16(final @NonNull TypeDefinition<?> type) { return BaseUint16Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type is the base type for uint64. * * @param type The type to check * @return If the type corresponds to the base uint64 type. * @throws NullPointerException if type is null */ public static boolean isUint64(final @NonNull TypeDefinition<?> type) { return BaseUint64Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type is the base type for uint8. * * @param type The type to check * @return If the type corresponds to the base uint8 type. * @throws NullPointerException if type is null */ public static boolean isUint8(final @NonNull TypeDefinition<?> type) { return BaseUint8Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type is the base type for uint32. * * @param type The type to check * @return If the type corresponds to the base uint32 type. * @throws NullPointerException if type is null */ public static boolean isUint32(final @NonNull TypeDefinition<?> type) { return BaseUint32Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type is the base type for uint8. * * @param type The type to check * @return If the type corresponds to the base uint8 type. * @throws NullPointerException if type is null */ public static boolean isUint8(final @NonNull TypeDefinition<?> type) { return BaseUint8Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type is the base type for uint16. * * @param type The type to check * @return If the type corresponds to the base uint16 type. * @throws NullPointerException if type is null */ public static boolean isUint16(final @NonNull TypeDefinition<?> type) { return BaseUint16Type.INSTANCE.getPath().equals(type.getPath()); }
/** * Check if a particular type is the base type for uint64. * * @param type The type to check * @return If the type corresponds to the base uint64 type. * @throws NullPointerException if type is null */ public static boolean isUint64(final @NonNull TypeDefinition<?> type) { return BaseUint64Type.INSTANCE.getPath().equals(type.getPath()); }
private void emitTypeNode(final SchemaPath parentPath, final TypeDefinition<?> subtype) { final SchemaPath path = subtype.getPath(); if (isPrefix(parentPath.getPathFromRoot(), path.getPathFromRoot())) { emitTypeNodeDerived(subtype); } else { emitTypeNodeReferenced(subtype); } }
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 static String getGetterName(final SchemaNode node, final TypeDefinition<?> typeDef) { final String suffix = JavaIdentifierNormalizer.normalizeSpecificIdentifier(node.getQName().getLocalName(), JavaIdentifier.CLASS); if (typeDef instanceof BooleanTypeDefinition && (typeDef.getPath().equals(node.getPath()) || typeDef.getBaseType() == null)) { return "is" + suffix; } return "get" + suffix; }