Package org.mule.metadata.api.utils
Class MetadataTypeUtils
- java.lang.Object
-
- org.mule.metadata.api.utils.MetadataTypeUtils
-
public final class MetadataTypeUtils extends Object
Utilities for handling values- Since:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetadataTypeUtils.TypeResolverVisitorMetadataTypeVisitorimplementation for resolving the typeId of a givenMetadataType.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddTypeAlias(TypeBuilder typeBuilder, String typeAlias)Gives a type alias to type specified by builder.static voidcheckArgument(boolean condition, String message)static Optional<String>getDefaultValue(MetadataType type)Returns the default value of aMetadataTypeif exist.static StringgetLocalPart(ObjectFieldType field)Returns the local part of anObjectFieldTypestatic Optional<String>getTypeId(MetadataType type)Returns the type id of aMetadataTypeif exist.static booleanhasExposedFields(MetadataType type)Returns if anObjectTypehas at least one exposed field or not, for any otherMetadataTypereturns false.static inthashCode(Optional<?>... optionals)static booleanisCollection(MetadataType type)Returns whether a metadata type is an instance of anArrayTypeor not.static booleanisEnum(MetadataType type)Indicates whether the giveMetadataTypeis an Enum or not.static booleanisNotNull(Object object)Checks if the given object is null or notstatic booleanisNullType(MetadataType type)Returns whether a metadata type is an instance ofNullTypeor not.static booleanisObjectType(MetadataType type)Returns whether a metadata type is an instance ofObjectTypeor not.static booleanisVoid(MetadataType type)Returns whether a metadata type is an instance ofVoidTypeor not.
-
-
-
Method Detail
-
checkArgument
public static void checkArgument(boolean condition, String message)- Parameters:
condition- Condition that the argument must satisfymessage- The Message of the exception in case the condition is invalid
-
getTypeId
public static Optional<String> getTypeId(MetadataType type)
Returns the type id of aMetadataTypeif exist.- Parameters:
type- the metadata type to search de type id from.
-
addTypeAlias
public static void addTypeAlias(TypeBuilder typeBuilder, String typeAlias)
Gives a type alias to type specified by builder.- Parameters:
typeBuilder- The type builder to annotate.typeAlias- The type alias to use.
-
getDefaultValue
public static Optional<String> getDefaultValue(MetadataType type)
Returns the default value of aMetadataTypeif exist.- Parameters:
type- the metadata type to search de default value from.
-
isVoid
public static boolean isVoid(MetadataType type)
Returns whether a metadata type is an instance ofVoidTypeor not.- Parameters:
type- the metadata type to check.
-
isNullType
public static boolean isNullType(MetadataType type)
Returns whether a metadata type is an instance ofNullTypeor not.- Parameters:
type- the metadata type to check.
-
isCollection
public static boolean isCollection(MetadataType type)
Returns whether a metadata type is an instance of anArrayTypeor not.- Parameters:
type- the metadata type to check.
-
isObjectType
public static boolean isObjectType(MetadataType type)
Returns whether a metadata type is an instance ofObjectTypeor not.- Parameters:
type- the metadata type to check.
-
hasExposedFields
public static boolean hasExposedFields(MetadataType type)
Returns if anObjectTypehas at least one exposed field or not, for any otherMetadataTypereturns false.- Parameters:
type- the metadata type to check.
-
getLocalPart
public static String getLocalPart(ObjectFieldType field)
Returns the local part of anObjectFieldType- Parameters:
field- the field to obtain the local part
-
isEnum
public static boolean isEnum(MetadataType type)
Indicates whether the giveMetadataTypeis an Enum or not.- Parameters:
type-MetadataTypeto check if it is an Enum
-
hashCode
public static int hashCode(Optional<?>... optionals)
-
isNotNull
public static boolean isNotNull(Object object)
Checks if the given object is null or not
-
-