Class TypeUtils
java.lang.Object
org.mule.runtime.extension.api.declaration.type.TypeUtils
Utility class to handle Java types and their relationship with the
MetadataType model- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringDeprecated.static Collection<Field>getAllFields(Class<?> declaringType) Returns all theFields in the givendeclaringType.static Collection<Class<?>>getAllSuperClasses(Class<?> type) Returns all the superclasses of the giventype, without includingObjectstatic Optional<org.mule.runtime.api.meta.model.display.ClassValueModel>getClassValueModel(Field field) Returns theClassValueModelof the givenFieldif either annotationClassValueorClassValueare presentgetDisplayName(Field field) Returns the display name of the givenFieldif either annotationDisplayNameorDisplayNameare presentgetExampleValue(Field field) static Collection<Field>getParameterFields(Class<?> declaringType) static Optional<org.mule.runtime.api.meta.model.display.PathModel>getPathModel(Field field) getPlacementValue(Field field) getSummaryValue(Field field) static <R extends Annotation>
booleanisAnnotationPresentOnField(Field field, Class<R> annotationClass) static <R extends Annotation,S extends Annotation>
booleanisAnnotationPresentOnField(Field field, Class<R> legacyAnnotationClass, Class<S> sdkAnnotationClass) static booleanisOptional(Field field) Checks if a field is optional or notstatic booleanisParameter(Field field) Checks if a field is a parameterstatic booleanisParameterGroup(Field field) Checks if a field is a parameter groupstatic booleanisPasswordField(Field field) static booleanisQueryField(Field field) static booleanisTextField(Field field)
-
Method Details
-
getParameterFields
Returns all theFields in the givendeclaringTypewhich are annotated withParameterbut also do not have theIgnoreone.The introspection also includes parent classes.
- Parameters:
declaringType- the class to introspect.- Returns:
- a
Collectionoffields. May be empty but will never benull
-
getAllFields
- Parameters:
declaringType- the class to introspect.- Returns:
- a
Collectionoffields. May be empty but will never benull
-
getAllSuperClasses
Returns all the superclasses of the giventype, without includingObject- Parameters:
type- a type- Returns:
- all the type's super classes
-
getAlias
Deprecated.since 1.5.0 useJavaParserUtils.getAlias(Field)insteadChecks the givenfieldfor theAliasannotation. If present,Alias.value()is returned. Otherwise,Field.getName()is returned.- Parameters:
field- aField- Returns:
- the field's alias
-
isParameter
Checks if a field is a parameter -
isParameterGroup
Checks if a field is a parameter group- Parameters:
field- aField- Returns:
- true if the
Fieldcontains either the annotationParameterGrouporParameterGroup - Since:
- 4.5
-
isOptional
Checks if a field is optional or not- Parameters:
field- the field to check- Returns:
- whether the field is optional or not
- Since:
- 4.5
-
getDisplayName
Returns the display name of the givenFieldif either annotationDisplayNameorDisplayNameare present- Parameters:
field- theFieldto be introspected- Returns:
Optionalcontaining the display name string if eitherDisplayNameorDisplayNameare present.- Since:
- 4.5
-
getSummaryValue
-
getExampleValue
-
getPathModel
-
getClassValueModel
public static Optional<org.mule.runtime.api.meta.model.display.ClassValueModel> getClassValueModel(Field field) Returns theClassValueModelof the givenFieldif either annotationClassValueorClassValueare present- Parameters:
field- theFieldto be introspected- Returns:
Optionalcontaining theClassValueModelif eitherClassValueorClassValueare present.- Since:
- 4.5
-
getPlacementValue
public static Optional<org.mule.runtime.api.util.Pair<Integer,String>> getPlacementValue(Field field) -
isTextField
-
isPasswordField
-
isQueryField
-
isAnnotationPresentOnField
public static <R extends Annotation> boolean isAnnotationPresentOnField(Field field, Class<R> annotationClass) -
isAnnotationPresentOnField
public static <R extends Annotation,S extends Annotation> boolean isAnnotationPresentOnField(Field field, Class<R> legacyAnnotationClass, Class<S> sdkAnnotationClass)
-
JavaParserUtils.getAlias(Field)instead