Class ExtensionModelUtils
ExtensionModel instances- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanacceptsExpressions(org.mule.runtime.api.meta.ExpressionSupport support) static booleancanBeUsedImplicitly(org.mule.runtime.api.meta.model.parameter.ParameterizedModel parameterizedModel) Returns whether the given model can be used implicitly.static booleancomponentHasAnImplicitConfiguration(org.mule.runtime.api.meta.model.ExtensionModel extension, org.mule.runtime.api.meta.model.ComponentModel component) Returns whether the givenComponentModelhas an associated configuration that can be created implicitly.static Set<org.mule.runtime.api.meta.model.config.ConfigurationModel>getConfigurationForComponent(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.ComponentModel component) static List<org.mule.runtime.api.meta.model.ComponentModel>getConnectedComponents(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) Returns aListwith all theComponentModelavailable to theextensionModelwhich requires a connection.static List<org.mule.runtime.api.meta.model.ComponentModel>getConnectedComponents(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel) Returns aListwith all theComponentModelavailable to theconfigurationModelwhich requires a connection.static ObjectgetDefaultValue(AccessibleObject object) getDefaultValue(String name, org.mule.metadata.api.model.MetadataType model) Retrieves the default value of a field for a givenMetadataTypegetDefaultValue(org.mule.runtime.api.meta.model.parameter.ParameterModel model) static StringgetDefaultValue(Optional optional) Returns the default value associated with the given annotation.static StringgetDefaultValue(org.mule.sdk.api.annotation.param.Optional optional) Returns the default value associated with the given annotation.static Optional<ClassLoader>getExtensionClassLoader(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) Gets the extensionClassLoaderstatic <T extends org.mule.runtime.api.meta.model.parameter.ParameterizedModel>
TgetFirstImplicit(List<T> models) Returns the first item in themodelsListthat can be used implicitly.static Stream<org.mule.runtime.api.util.Pair<org.mule.runtime.api.meta.model.parameter.ParameterGroupModel,org.mule.runtime.api.meta.model.parameter.ParameterModel>> getGroupAndParametersPairs(org.mule.runtime.api.meta.model.parameter.ParameterizedModel model) Given aParameterizedModel, it returns a stream with all pairs of groups and parameters involving this modelstatic booleanhasExpressionDefaultValue(org.mule.runtime.api.meta.model.parameter.ParameterModel model) static booleanisContent(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel) static booleanisContent(org.mule.runtime.api.meta.model.parameter.ParameterRole purpose) static booleanisInfrastructure(org.mule.runtime.api.meta.model.parameter.ParameterModel parameter) static booleanisRequired(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel group) Tests if the givengroupcontains at least one requiredParameterModelstatic booleanisRouter(org.mule.runtime.api.meta.model.ComponentModel model) static booleanisRouter(org.mule.runtime.api.meta.model.construct.ConstructModel model) static booleanisScope(org.mule.runtime.api.meta.model.ComponentModel model) static booleanisText(org.mule.runtime.api.meta.model.parameter.ParameterModel parameter) static booleanrequiresConfig(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.NamedObject component) static org.mule.runtime.api.meta.model.parameter.ParameterRolestatic booleansupportsConnectivity(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel) static booleansupportsMultiple(org.mule.runtime.api.meta.model.nested.NestedRouteModel routeModel) static org.mule.runtime.api.meta.model.display.ClassValueModeltoClassValueModel(ClassValue annotation) Uses the value in the givenannotationand transforms it into aClassValueModeltoSubTypesMap(Collection<org.mule.runtime.api.meta.model.SubTypesModel> subTypes)
-
Method Details
-
getDefaultValue
public static Optional<String> getDefaultValue(org.mule.runtime.api.meta.model.parameter.ParameterModel model) - Parameters:
model- theparameterwho's default value is wanted- Returns:
- the default value of the parameter
-
hasExpressionDefaultValue
public static boolean hasExpressionDefaultValue(org.mule.runtime.api.meta.model.parameter.ParameterModel model) - Parameters:
model- theparameterwho's default value is analyzed- Returns:
- Whether or not the default value is an expression
- Since:
- 1.2
-
getDefaultValue
public static Optional<String> getDefaultValue(String name, org.mule.metadata.api.model.MetadataType model) Retrieves the default value of a field for a givenMetadataType- Parameters:
name- the field's namemodel- theMetadataTypecontaining the field who's default value is wanted- Returns:
- the default value of the given parameter
-
acceptsExpressions
public static boolean acceptsExpressions(org.mule.runtime.api.meta.ExpressionSupport support) - Parameters:
support- aExpressionSupport- Returns:
- Whether or not the given
supportis one which accepts or requires expressions
-
getConnectedComponents
public static List<org.mule.runtime.api.meta.model.ComponentModel> getConnectedComponents(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) Returns aListwith all theComponentModelavailable to theextensionModelwhich requires a connection. This includes bothSourceModelandOperationModel.- Parameters:
extensionModel- aExtensionModel- Returns:
- a
ListofComponentModel. It might be empty but will never benull
-
getConnectedComponents
public static List<org.mule.runtime.api.meta.model.ComponentModel> getConnectedComponents(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel) Returns aListwith all theComponentModelavailable to theconfigurationModelwhich requires a connection. This includes bothSourceModelandOperationModel.- Parameters:
extensionModel- theExtensionModelthat owns theconfigurationModelconfigurationModel- theConfigurationModelwhich components you want- Returns:
- a
ListofComponentModel. It might be empty but will never benull
-
supportsConnectivity
public static boolean supportsConnectivity(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.config.ConfigurationModel configurationModel) - Parameters:
extensionModel- aExtensionModelconfigurationModel- aConfigurationModel- Returns:
- Whether at least one of the models have a
ConnectionProviderModel - Since:
- 1.1.4
-
requiresConfig
public static boolean requiresConfig(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.NamedObject component) - Parameters:
extensionModel- the model which owns thecomponentcomponent- a component- Returns:
- Whether the given
componentneeds to be provided with a config in order to function
-
getConfigurationForComponent
public static Set<org.mule.runtime.api.meta.model.config.ConfigurationModel> getConfigurationForComponent(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, org.mule.runtime.api.meta.model.ComponentModel component) - Parameters:
extensionModel- the model which owns thecomponentcomponent- a component- Returns:
- A
Setwith theConfigurationModelthat the can be used alongside with thecomponent
-
isContent
public static boolean isContent(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel) -
isText
public static boolean isText(org.mule.runtime.api.meta.model.parameter.ParameterModel parameter) - Returns:
trueif the givenParameterModelhas layout propertyLayoutModel.isText()
-
isContent
public static boolean isContent(org.mule.runtime.api.meta.model.parameter.ParameterRole purpose) -
roleOf
-
toSubTypesMap
public static Map<org.mule.metadata.api.model.ObjectType,Set<org.mule.metadata.api.model.ObjectType>> toSubTypesMap(Collection<org.mule.runtime.api.meta.model.SubTypesModel> subTypes) -
isInfrastructure
public static boolean isInfrastructure(org.mule.runtime.api.meta.model.parameter.ParameterModel parameter) - Returns:
trueif the givenParameterModelwas enriched withInfrastructureParameterModelProperty
-
getFirstImplicit
public static <T extends org.mule.runtime.api.meta.model.parameter.ParameterizedModel> T getFirstImplicit(List<T> models) Returns the first item in themodelsListthat can be used implicitly.A
ParameterizedModelis consider to be implicit when all itsParameterModels are optional- Type Parameters:
T- the generic type of the items in themodels. It's a type which is assignable fromParameterizedModel- Parameters:
models- aListofT- Returns:
- one of the items in
modelsornullif none of the models are implicit
-
canBeUsedImplicitly
public static boolean canBeUsedImplicitly(org.mule.runtime.api.meta.model.parameter.ParameterizedModel parameterizedModel) Returns whether the given model can be used implicitly. That means that all of its parameters are optional.- Parameters:
parameterizedModel- model- Returns:
- whether the given model can be used implicitly or not.
-
componentHasAnImplicitConfiguration
public static boolean componentHasAnImplicitConfiguration(org.mule.runtime.api.meta.model.ExtensionModel extension, org.mule.runtime.api.meta.model.ComponentModel component) Returns whether the givenComponentModelhas an associated configuration that can be created implicitly.- Parameters:
extension- the extension where the component belongscomponent- the actual component to check for the implicit config- Returns:
- true if the component has an implicit associated config, false otherwise.
-
getDefaultValue
Returns the default value associated with the given annotation.The reason for this method to be instead of simply using
Optional.defaultValue()is a limitation on the Java language to have an annotation which defaults to anullvalue. For that reason, this method tests the default value for equality against theOptional.NULL. If such test is positive, thennullis returned.If a
nulloptionalis supplied, then this method returnsnull- Parameters:
optional- a nullable annotation- Returns:
- the default value associated to the annotation or
null
-
getDefaultValue
Returns the default value associated with the given annotation.The reason for this method to be instead of simply using
Optional.defaultValue()is a limitation on the Java language to have an annotation which defaults to anullvalue. For that reason, this method tests the default value for equality against theOptional.NULL. If such test is positive, thennullis returned.If a
nulloptionalis supplied, then this method returnsnull- Parameters:
optional- a nullable annotation- Returns:
- the default value associated to the annotation or
null
-
getDefaultValue
Tests the givenobjectto be annotated withOptionalorOptional.If the annotation is present, then a default value is extracted by the rules of
getDefaultValue(org.mule.runtime.extension.api.annotation.param.Optional)orgetDefaultValue(org.mule.sdk.api.annotation.param.Optional). Otherwise,nullis returned.Notice that a
nullreturn value doesn't necessarily mean that the annotation is not present. It could well be thatnullhappens to be the default value.- Parameters:
object- an object potentially annotated withOptionalorOptional- Returns:
- A default value or
null
-
isRequired
public static boolean isRequired(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel group) Tests if the givengroupcontains at least one requiredParameterModel- Parameters:
group- theParameterGroupModelto be inspected- Returns:
trueif the givengroupcontains at least one requiredParameterModel
-
toClassValueModel
public static org.mule.runtime.api.meta.model.display.ClassValueModel toClassValueModel(ClassValue annotation) Uses the value in the givenannotationand transforms it into aClassValueModel- Parameters:
annotation- an annotation- Returns:
- a
ClassValueModel
-
getExtensionClassLoader
public static Optional<ClassLoader> getExtensionClassLoader(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) Gets the extensionClassLoader- Parameters:
extensionModel-- Returns:
- an
Optionalwith the extensionClassLoader
-
getGroupAndParametersPairs
public static Stream<org.mule.runtime.api.util.Pair<org.mule.runtime.api.meta.model.parameter.ParameterGroupModel,org.mule.runtime.api.meta.model.parameter.ParameterModel>> getGroupAndParametersPairs(org.mule.runtime.api.meta.model.parameter.ParameterizedModel model) Given aParameterizedModel, it returns a stream with all pairs of groups and parameters involving this model- Parameters:
model-- Returns:
- a
StreamofPairofParameterGroupModeland itsParameterModel, associated to the model.
-
isScope
public static boolean isScope(org.mule.runtime.api.meta.model.ComponentModel model) - Parameters:
model- aComponentModel- Returns:
- Whether the given
modelrepresents a Scope - Since:
- 1.5.0
-
isRouter
public static boolean isRouter(org.mule.runtime.api.meta.model.construct.ConstructModel model) - Parameters:
model- aConstructModel- Returns:
- Whether the given
modelrepresents a Router - Since:
- 1.5.0
-
isRouter
public static boolean isRouter(org.mule.runtime.api.meta.model.ComponentModel model) - Parameters:
model- aComponentModel- Returns:
- Whether the given
modelrepresents a Router - Since:
- 1.7.0
-
supportsMultiple
public static boolean supportsMultiple(org.mule.runtime.api.meta.model.nested.NestedRouteModel routeModel)
-