Class ExtensionMetadataTypeUtils

java.lang.Object
org.mule.runtime.extension.api.util.ExtensionMetadataTypeUtils

public final class ExtensionMetadataTypeUtils extends Object
Set of utility operations to handle MetadataType
Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    acceptsReferences(org.mule.metadata.api.model.MetadataType metadataType)
     
    static boolean
    allowsInlineDefinition(org.mule.metadata.api.model.MetadataType type)
     
    static boolean
    allowsReferences(org.mule.metadata.api.model.MetadataType type)
     
    static boolean
    allowsTopLevelDefinition(org.mule.metadata.api.model.MetadataType type)
     
    static boolean
    areTypesEqual(org.mule.metadata.api.model.MetadataType type, org.mule.metadata.api.model.MetadataType otherType)
    Check whether the given MetadataTypes can be considered equal.
    static String
    getAlias(org.mule.metadata.api.model.MetadataType metadataType)
     
    static String
    getAlias(org.mule.metadata.api.model.MetadataType metadataType, String defaultName)
     
    static String
    getAlias(org.mule.metadata.api.model.ObjectFieldType fieldType)
     
    getBaseType(org.mule.metadata.api.model.MetadataType metadataType)
     
    static org.mule.runtime.api.meta.ExpressionSupport
    getExpressionSupport(org.mule.metadata.api.model.MetadataType metadataType)
    Checks the given metadataType for the ExpressionSupportAnnotation.
    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)
     
    static Set<String>
    getSemanticTerms(org.mule.metadata.api.model.MetadataType type)
     
    getSubstitutionGroup(org.mule.metadata.api.model.MetadataType metadataType)
     
    static <T> Optional<Class<T>>
    getType(org.mule.metadata.api.model.MetadataType metadataType)
     
    static <T> Optional<Class<T>>
    getType(org.mule.metadata.api.model.MetadataType metadataType, ClassLoader classloader)
     
    static boolean
    isBasic(org.mule.metadata.api.model.MetadataType metadataType)
     
    static boolean
    isFinal(org.mule.metadata.api.model.MetadataType metadataType)
     
    static boolean
    isFlattenedParameterGroup(org.mule.metadata.api.model.MetadataType type)
     
    static boolean
    isInfrastructure(org.mule.metadata.api.model.MetadataType type)
    Returns true if the type is an infrastructure type, false otherwise.
    static boolean
    isJavaCollection(org.mule.metadata.api.model.MetadataType metadataType)
    Returns a Boolean indicating whether the given MetadataType is a Java Collection or not.
    static boolean
    isMap(org.mule.metadata.api.model.MetadataType metadataType)
     
    static boolean
    isMapOfStrings(org.mule.metadata.api.model.MetadataType metadataType)
     
    static boolean
    isReferableType(org.mule.metadata.api.model.MetadataType type)
     
    static boolean
    isTypedValue(org.mule.metadata.api.model.MetadataType metadataType)
     
    static void
    registerType(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer declarer, org.mule.metadata.api.model.MetadataType type)
     
    static org.mule.metadata.api.model.MetadataFormat
    Returns a MetadataFormat which represents the given mediaType.
    static org.mule.metadata.api.model.MetadataFormat
    toMetadataFormat(org.mule.runtime.api.metadata.MediaType mediaType)
    Returns a MetadataFormat which represents the given mediaType.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getId

      public static Optional<String> getId(org.mule.metadata.api.model.MetadataType metadataType)
    • getType

      public static <T> Optional<Class<T>> getType(org.mule.metadata.api.model.MetadataType metadataType)
      Parameters:
      metadataType - the ObjectType who's type is required
      Returns:
      the type of the given ObjectType if 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 - the ObjectType who's type is required
      classloader - the ClassLoader to use when looking for the Class
      Returns:
      the type of the given ObjectType if one exists in the current classloader, Optional.empty() otherwise.
    • getAlias

      public static String getAlias(org.mule.metadata.api.model.ObjectFieldType fieldType)
      Parameters:
      fieldType - the ObjectFieldType to inspect to retrieve its type Alias
      Returns:
      the Alias name of the ObjectFieldType
    • getAlias

      public static String getAlias(org.mule.metadata.api.model.MetadataType metadataType)
      Parameters:
      metadataType - the MetadataType to inspect to retrieve its type Alias
      Returns:
      the Alias name of the MetadataType
    • getAlias

      public static String getAlias(org.mule.metadata.api.model.MetadataType metadataType, String defaultName)
      Parameters:
      metadataType - the MetadataType to inspect to retrieve its type Alias
      defaultName - default name to use if metadataType alias is not defined
      Returns:
      the Alias name of the MetadataType or the defaultName if 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 - the MetadataType to inspect
      Returns:
      whether the metadataType represents a Map or 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:
      true if the type is marked as a FlattenedType
    • allowsInlineDefinition

      public static boolean allowsInlineDefinition(org.mule.metadata.api.model.MetadataType type)
      Returns:
      true if the given MetadataType should support inline definition as child element
    • allowsTopLevelDefinition

      public static boolean allowsTopLevelDefinition(org.mule.metadata.api.model.MetadataType type)
      Returns:
      whether the given MetadataType should support being defined as a top level element
    • allowsReferences

      public static boolean allowsReferences(org.mule.metadata.api.model.MetadataType type)
      Returns:
      whether the given MetadataType should support registry references
    • getExpressionSupport

      public static org.mule.runtime.api.meta.ExpressionSupport getExpressionSupport(org.mule.metadata.api.model.MetadataType metadataType)
      Checks the given metadataType for the ExpressionSupportAnnotation.

      If present, the ExpressionSupportAnnotation.getExpressionSupport() value is returned. Otherwise, it defaults to ExpressionSupport.SUPPORTED

      Parameters:
      metadataType - a MetadataType
      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 LayoutModel if the metadataType contains 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 metadataType accept 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 a MetadataFormat which represents the given mediaType.

      If the mediaType matches any of the well known formats, then it will return one of those. Otherwise, a new MetadataFormat will be created and returned

      Parameters:
      mediaType - a MediaType
      Returns:
      a MetadataFormat
    • toMetadataFormat

      public static org.mule.metadata.api.model.MetadataFormat toMetadataFormat(String mediaType)
      Returns a MetadataFormat which represents the given mediaType.

      If the mediaType matches any of the well known formats, then it will return one of those. Otherwise, a new MetadataFormat will 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 a Boolean indicating whether the given MetadataType is a Java Collection or not.
      Parameters:
      metadataType - MetadataType to introspect
      Returns:
      a boolean
    • isTypedValue

      public static boolean isTypedValue(org.mule.metadata.api.model.MetadataType metadataType)
      Returns:
      true if the given MetadataType is representing the generic of a TypedValue
    • isReferableType

      public static boolean isReferableType(org.mule.metadata.api.model.MetadataType type)
      Returns:
      true if 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 given MetadataTypes can be considered equal.
      Since:
      1.4.0
    • getSemanticTerms

      public static Set<String> getSemanticTerms(org.mule.metadata.api.model.MetadataType type)
    • registerType

      public static void registerType(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclarer declarer, org.mule.metadata.api.model.MetadataType type)