Class ExtensionMetadataTypeUtils
java.lang.Object
org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils
Set of utility operations to handle
MetadataType- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanacceptsReferences(org.mule.metadata.api.model.MetadataType metadataType) static booleanallowsInlineDefinition(org.mule.metadata.api.model.MetadataType type) static booleanallowsReferences(org.mule.metadata.api.model.MetadataType type) static booleanallowsTopLevelDefinition(org.mule.metadata.api.model.MetadataType type) static booleanareTypesEqual(org.mule.metadata.api.model.MetadataType type, org.mule.metadata.api.model.MetadataType otherType) Check whether the givenMetadataTypes can be considered equal.static StringgetAlias(org.mule.metadata.api.model.MetadataType metadataType) static Stringstatic StringgetAlias(org.mule.metadata.api.model.ObjectFieldType fieldType) static Optional<DslBaseType>getBaseType(org.mule.metadata.api.model.MetadataType metadataType) static org.mule.runtime.api.meta.ExpressionSupportgetExpressionSupport(org.mule.metadata.api.model.MetadataType metadataType) Checks the givenmetadataTypefor theExpressionSupportAnnotation.getId(org.mule.metadata.api.model.MetadataType metadataType) static Optional<org.mule.runtime.api.meta.model.display.LayoutModel>getLayoutModel(org.mule.metadata.api.model.MetadataType metadataType) getSemanticTerms(org.mule.metadata.api.model.MetadataType type) static Optional<SubstitutionGroup>getSubstitutionGroup(org.mule.metadata.api.model.MetadataType metadataType) getType(org.mule.metadata.api.model.MetadataType metadataType) getType(org.mule.metadata.api.model.MetadataType metadataType, ClassLoader classloader) static booleanisBasic(org.mule.metadata.api.model.MetadataType metadataType) static booleanisFinal(org.mule.metadata.api.model.MetadataType metadataType) static booleanisFlattenedParameterGroup(org.mule.metadata.api.model.MetadataType type) static booleanisInfrastructure(org.mule.metadata.api.model.MetadataType type) Returns true if the type is an infrastructure type, false otherwise.static booleanisJavaCollection(org.mule.metadata.api.model.MetadataType metadataType) Returns aBooleanindicating whether the givenMetadataTypeis a Java Collection or not.static booleanisMap(org.mule.metadata.api.model.MetadataType metadataType) static booleanisMapOfStrings(org.mule.metadata.api.model.MetadataType metadataType) static booleanisReferableType(org.mule.metadata.api.model.MetadataType type) static booleanisTypedValue(org.mule.metadata.api.model.MetadataType metadataType) static voidregisterType(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer declarer, org.mule.metadata.api.model.MetadataType type) static org.mule.metadata.api.model.MetadataFormattoMetadataFormat(String mediaType) Returns aMetadataFormatwhich represents the givenmediaType.static org.mule.metadata.api.model.MetadataFormattoMetadataFormat(org.mule.runtime.api.metadata.MediaType mediaType) Returns aMetadataFormatwhich represents the givenmediaType.
-
Method Details
-
getId
-
getType
- Parameters:
metadataType- theObjectTypewho'stypeis required- Returns:
- the
typeof the givenObjectTypeif one exists in the current classloader,Optional.empty()otherwise.
-
getType
public static <T> Optional<Class<T>> getType(org.mule.metadata.api.model.MetadataType metadataType, ClassLoader classloader) - Parameters:
metadataType- theObjectTypewho'stypeis requiredclassloader- theClassLoaderto use when looking for theClass- Returns:
- the
typeof the givenObjectTypeif one exists in the current classloader,Optional.empty()otherwise.
-
getAlias
- Parameters:
fieldType- theObjectFieldTypeto inspect to retrieve its type Alias- Returns:
- the
Aliasname of theObjectFieldType
-
getAlias
- Parameters:
metadataType- theMetadataTypeto inspect to retrieve its type Alias- Returns:
- the
Aliasname of theMetadataType
-
getAlias
public static String getAlias(org.mule.metadata.api.model.MetadataType metadataType, String defaultName) - Parameters:
metadataType- theMetadataTypeto inspect to retrieve its type AliasdefaultName- default name to use ifmetadataTypealias is not defined- Returns:
- the
Aliasname of theMetadataTypeor thedefaultNameif alias was not specified
-
isFinal
public static boolean isFinal(org.mule.metadata.api.model.MetadataType metadataType) -
isMap
public static boolean isMap(org.mule.metadata.api.model.MetadataType metadataType) - Parameters:
metadataType- theMetadataTypeto inspect- Returns:
- whether the
metadataTyperepresents aMapor not
-
isMapOfStrings
public static boolean isMapOfStrings(org.mule.metadata.api.model.MetadataType metadataType) -
isFlattenedParameterGroup
public static boolean isFlattenedParameterGroup(org.mule.metadata.api.model.MetadataType type) - Returns:
trueif the type is marked as aFlattenedType
-
allowsInlineDefinition
public static boolean allowsInlineDefinition(org.mule.metadata.api.model.MetadataType type) - Returns:
trueif the givenMetadataTypeshould support inline definition as child element
-
allowsTopLevelDefinition
public static boolean allowsTopLevelDefinition(org.mule.metadata.api.model.MetadataType type) - Returns:
- whether the given
MetadataTypeshould support being defined as a top level element
-
allowsReferences
public static boolean allowsReferences(org.mule.metadata.api.model.MetadataType type) - Returns:
- whether the given
MetadataTypeshould support registry references
-
getExpressionSupport
public static org.mule.runtime.api.meta.ExpressionSupport getExpressionSupport(org.mule.metadata.api.model.MetadataType metadataType) Checks the givenmetadataTypefor theExpressionSupportAnnotation.If present, the
ExpressionSupportAnnotation.getExpressionSupport()value is returned. Otherwise, it defaults toExpressionSupport.SUPPORTED- Parameters:
metadataType- aMetadataType- Returns:
- a
ExpressionSupport
-
getLayoutModel
public static Optional<org.mule.runtime.api.meta.model.display.LayoutModel> getLayoutModel(org.mule.metadata.api.model.MetadataType metadataType) - Parameters:
metadataType- a type model- Returns:
- a
LayoutModelif themetadataTypecontains layout information
-
isInfrastructure
public static boolean isInfrastructure(org.mule.metadata.api.model.MetadataType type) Returns true if the type is an infrastructure type, false otherwise.- Parameters:
type- the type to check- Returns:
- whether is an infrastructure type or not.
-
acceptsReferences
public static boolean acceptsReferences(org.mule.metadata.api.model.MetadataType metadataType) - Parameters:
metadataType- a type model- Returns:
- whether instances of the given
metadataTypeaccept being referenced to
-
isBasic
public static boolean isBasic(org.mule.metadata.api.model.MetadataType metadataType) -
getSubstitutionGroup
public static Optional<SubstitutionGroup> getSubstitutionGroup(org.mule.metadata.api.model.MetadataType metadataType) - Parameters:
metadataType-- Returns:
- the substitutionGroup defined by the user or
Optional.empty()if not present.
-
getBaseType
public static Optional<DslBaseType> getBaseType(org.mule.metadata.api.model.MetadataType metadataType) - Parameters:
metadataType-- Returns:
- the baseType defined by the user or {Optional.empty()} if not present
-
toMetadataFormat
public static org.mule.metadata.api.model.MetadataFormat toMetadataFormat(org.mule.runtime.api.metadata.MediaType mediaType) Returns aMetadataFormatwhich represents the givenmediaType.If the
mediaTypematches any of the well known formats, then it will return one of those. Otherwise, a newMetadataFormatwill be created and returned- Parameters:
mediaType- aMediaType- Returns:
- a
MetadataFormat
-
toMetadataFormat
Returns aMetadataFormatwhich represents the givenmediaType.If the
mediaTypematches any of the well known formats, then it will return one of those. Otherwise, a newMetadataFormatwill be created and returned- Parameters:
mediaType- a media type represented as a String in valid RFC format.- Returns:
- a
MetadataFormat
-
isJavaCollection
public static boolean isJavaCollection(org.mule.metadata.api.model.MetadataType metadataType) Returns aBooleanindicating whether the givenMetadataTypeis a Java Collection or not.- Parameters:
metadataType-MetadataTypeto introspect- Returns:
- a
boolean
-
isTypedValue
public static boolean isTypedValue(org.mule.metadata.api.model.MetadataType metadataType) - Returns:
trueif the givenMetadataTypeis representing the generic of aTypedValue
-
isReferableType
public static boolean isReferableType(org.mule.metadata.api.model.MetadataType type) - Returns:
trueif the given type can receive the result of a registry reference
-
areTypesEqual
public static boolean areTypesEqual(org.mule.metadata.api.model.MetadataType type, org.mule.metadata.api.model.MetadataType otherType) Check whether the givenMetadataTypes can be considered equal.- Since:
- 1.4.0
-
getSemanticTerms
-
registerType
public static void registerType(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer declarer, org.mule.metadata.api.model.MetadataType type)
-