public final class IntrospectionUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
assignableFromAny(Class<?> type,
Collection<Class<?>> matchingTypes)
Determines if the given
type is assignable from any of the matchingTypes |
static void |
checkInstantiable(Class<?> declaringClass,
boolean requireDefaultConstructor,
ReflectionCache reflectionCache) |
static void |
checkInstantiable(Class<?> declaringClass,
ReflectionCache reflectionCache) |
static Set<Class<?>> |
collectRelativeClasses(org.mule.metadata.api.model.MetadataType type,
ClassLoader extensionClassLoader)
Given a
MetadataType it adds all the Class that are related from that type. |
static Set<String> |
collectRelativeClassesAsString(org.mule.metadata.api.model.MetadataType type)
Given a
MetadataType it adds all the Class that are related from that type. |
static Optional<Field> |
fetchConfigFieldFromSourceObject(Object object)
Given a Source object, fetches the Config field from the object if any.
|
static Optional<Field> |
fetchConnectionFieldFromSourceObject(Object object)
Given a Source object, fetches the Connection field from the object if any.
|
static List<Class<?>> |
findGenericsInSuperHierarchy(Class<?> type) |
static String |
getAlias(Field field)
Returns the
Alias or Alias name of the given field. |
static Optional<AnnotatedElement> |
getAnnotatedElement(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration<?> declaration) |
static List<Field> |
getAnnotatedFields(Class<?> clazz,
Class<? extends Annotation>... annotationTypes) |
static Stream<Field> |
getAnnotatedFieldsStream(Class<?> clazz,
Class<? extends Annotation>... annotationTypes)
Returns a
Stream with the fields annotated with any of the given annotationTypes |
static <T extends Annotation> |
getAnnotation(Class<?> annotatedClass,
Class<T> annotationClass)
Looks for the annotation in the given class.
|
static Collection<Method> |
getApiMethods(Class<?> declaringClass) |
static Collection<ExecutableElement> |
getApiMethods(TypeElement typeElement,
ProcessingEnvironment processingEnvironment) |
static Optional<org.mule.runtime.api.meta.model.connection.ConnectionProviderModel> |
getConnectionProviderModel(Class<? extends org.mule.runtime.api.connection.ConnectionProvider> connectionProvider,
List<org.mule.runtime.api.meta.model.connection.ConnectionProviderModel> allConnectionProviders)
Resolves the correspondent
ConnectionProviderModel for a given ConnectionProvider instance. |
static String |
getContainerName(AnnotatedElement container) |
static Optional<FieldSetter> |
getDefaultEncodingFieldSetter(Object target,
ReflectionCache reflectionCache)
|
static Collection<Field> |
getExposedFields(Class<?> extensionType,
ReflectionCache reflectionCache) |
static Optional<org.mule.runtime.api.meta.ExpressionSupport> |
getExpressionSupport(WithAnnotations annotatedElement,
String elementType,
String elementName) |
static Optional<Field> |
getField(Class<?> clazz,
org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration parameterDeclaration,
ReflectionCache reflectionCache) |
static Optional<Field> |
getField(Class<?> clazz,
org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel,
ReflectionCache reflectionCache) |
static Optional<Field> |
getField(Class<?> clazz,
String name,
ReflectionCache reflectionCache) |
static Optional<Field> |
getFieldByNameOrAlias(Class<?> clazz,
String nameOrAlias,
ReflectionCache reflectionCache) |
static org.mule.metadata.api.model.MetadataType |
getFieldMetadataType(Field field,
org.mule.metadata.api.ClassTypeLoader typeLoader)
Returns a
MetadataType describing the given Field's type |
static List<Field> |
getFields(Class<?> clazz) |
static List<VariableElement> |
getFields(TypeElement typeElement,
ProcessingEnvironment processingEnvironment) |
static List<Field> |
getFieldsOfType(Class<?> introspectedType,
Class fieldType) |
static Set<Field> |
getFieldsWithGetters(Class<?> extensionType,
ReflectionCache reflectionCache) |
static List<FieldElement> |
getFieldsWithGetters(Type extensionType) |
static Object |
getFieldValue(Object object,
String fieldName,
ReflectionCache reflectionCache)
Resolves and returns the field value of an object instance
|
static Map<org.mule.runtime.api.meta.model.parameter.ParameterGroupModel,Set<org.mule.runtime.api.meta.model.parameter.ParameterModel>> |
getFilteredParameters(org.mule.runtime.api.meta.model.ComponentModel componentModel,
Predicate<org.mule.runtime.api.meta.model.parameter.ParameterModel> filter)
Returns, for each parameter group defined on the component model, all the parameters matching with the given filter
|
static List<org.mule.metadata.api.model.MetadataType> |
getGenerics(Type type,
org.mule.metadata.api.ClassTypeLoader typeLoader) |
static String |
getGroupModelContainerName(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel groupModel) |
static String |
getImplementingName(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration parameterDeclaration)
Resolves the original name of a parameter before it was modified due to the usage of an Alias.
|
static String |
getImplementingName(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel)
Resolves the original name of a parameter before it was modified due to the usage of an Alias.
|
static List<Type> |
getInterfaceGenerics(Type type,
Class<?> implementedInterface) |
static Optional<Field> |
getMemberField(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel) |
static String |
getMemberName(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel,
String defaultName) |
static <T extends org.mule.runtime.api.meta.model.EnrichableModel & org.mule.runtime.api.meta.NamedObject> |
getMemberName(T enrichableNamedModel) |
static org.mule.metadata.api.model.MetadataType |
getMetadataType(Class<?> type,
org.mule.metadata.api.ClassTypeLoader typeLoader)
Returns a
MetadataType representing the given Class type. |
static org.mule.metadata.api.model.MetadataType |
getMetadataType(Type type) |
static org.mule.metadata.api.model.MetadataType[] |
getMethodArgumentTypes(Method method,
org.mule.metadata.api.ClassTypeLoader typeLoader)
Returns an array of
MetadataType representing each of the given Method's argument types. |
static org.mule.metadata.api.model.MetadataType |
getMethodReturnAttributesType(MethodElement method)
Returns a
MetadataType representing the Result.getAttributes() that will be set after executing the given
method. |
static org.mule.metadata.api.model.MetadataType |
getMethodReturnType(MethodElement method) |
static Collection<Method> |
getMethodsAnnotatedWith(Class<?> declaringClass,
Class<? extends Annotation> annotationType)
Returns all the methods in the
declaringClass which are annotated with annotationType, including those
declared in super classes. |
static Collection<Method> |
getMethodsAnnotatedWith(Class<?> declaringClass,
Class<? extends Annotation> annotationType,
boolean superClasses)
Returns all the methods in the
declaringClass which are annotated with annotationType |
static Stream<ExecutableElement> |
getMethodsStream(TypeElement typeElement,
boolean superClasses,
ProcessingEnvironment processingEnvironment) |
static Optional<Class<?>> |
getNullSafeDefaultImplementedType(Field field) |
static org.mule.runtime.api.util.Pair<org.springframework.core.ResolvableType,org.springframework.core.ResolvableType> |
getPagingProviderTypes(org.springframework.core.ResolvableType pagingProvider)
Introspects a
PagingProvider type and returns their generics. |
static org.mule.runtime.api.util.Pair<Type,Type> |
getPagingProviderTypes(Type type)
Introspects a
PagingProvider type and returns their generics. |
static Set<Class<?>> |
getParameterClasses(org.mule.runtime.api.meta.model.ExtensionModel extensionModel,
ClassLoader extensionClassLoader)
Traverses through all the
ParameterModels of the extensionModel and returns the classes that
are modeled by each parameter's Typed.getType(). |
static <T> T |
getParameterOrDefault(org.mule.runtime.extension.api.runtime.operation.ExecutionContext<? extends org.mule.runtime.api.meta.model.ComponentModel> ctx,
org.mule.runtime.api.meta.model.parameter.ParameterGroupModel parameterGroupModel,
org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel,
T defaultValue,
ReflectionCache reflectionCache)
Returns the value associated to a parameter with model
parameterModel on the group parameterGroupModel or
defaultValue if such parameter is not present |
static Object |
getParameterValue(Object object,
org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel,
ReflectionCache reflectionCache)
Returns the value for the given parameter of an object instance
|
static List<PropertyDescriptor> |
getPropertyDescriptors(Class<?> extensionType) |
static Optional<FieldSetter> |
getRefNameFieldSetter(Object target,
ReflectionCache reflectionCache)
|
static org.mule.metadata.api.model.MetadataType |
getReturnType(Type returnType) |
static Map<String,String> |
getShowInDslParameters(org.mule.runtime.api.meta.model.parameter.ParameterizedModel parameterizedModel)
Given a
ParameterizedModel iterates over all the parameter groups show in dsl and returns a mapping of parameter name
and parameter group name. |
static String |
getSourceName(Class<?> sourceType) |
static org.mule.metadata.api.model.MetadataType |
getSourceReturnType(Type returnType)
Returns the
MetadataType for a source's output. |
static Set<Class<?>> |
getSubtypeClasses(org.mule.runtime.api.meta.model.ExtensionModel extensionModel,
ClassLoader extensionClassLoader)
Traverses through all the
object types of the extension model's
SubTypesModel and returns the classes that are used behind of each type. |
static List<Type> |
getSuperClassGenerics(Type currentType,
Class<?> superClass) |
static List<TypeMirror> |
getSuperClassGenerics(TypeElement type,
Class superClass,
ProcessingEnvironment processingEnvironment) |
static void |
injectComponentLocation(Object target,
org.mule.runtime.api.component.location.ComponentLocation componentLocation)
Introspects the
target object for a field of type ComponentLocation. |
static void |
injectDefaultEncoding(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
String encoding)
Sets the
encoding value into the field of the target annotated DefaultEncoding if the model
contains the DeclaringMemberModelProperty property and the value is not null. |
static void |
injectFields(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
String configName,
String encoding,
org.mule.runtime.api.meta.MuleVersion muleVersion)
Sets the
configName, encoding and MuleVersion into the fields of the target annotated with
RefName, DefaultEncoding and RuntimeVersion respectively if present and the model contains
the DeclaringMemberModelProperty. |
static void |
injectFields(Object target,
String configName,
String encoding,
org.mule.runtime.api.meta.MuleVersion muleVersion,
ReflectionCache reflectionCache)
Sets the
configName, encoding and MuleVersion into the fields of the target annotated with
RefName, DefaultEncoding and RuntimeVersion respectively if present. |
static void |
injectRefName(Object target,
String configName,
ReflectionCache reflectionCache)
Introspects the
target object for a field annotated with RefName or
RefName. |
static void |
injectRuntimeVersion(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
org.mule.runtime.api.meta.MuleVersion muleVersion)
Sets the
MuleVersion into the field of the target annotated RuntimeVersion if the model
contains the DeclaringMemberModelProperty property and the value is not null. |
static boolean |
isASTMode(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration model)
Based on a
BaseDeclaration, determines if this one has been created using the Java AST. |
static boolean |
isASTMode(org.mule.runtime.api.meta.model.ExtensionModel model)
Based on a
ExtensionModel, determines if this one has been created using the Java AST. |
static boolean |
isConfigOverride(Field field) |
static boolean |
isIgnored(WithAnnotations element,
org.mule.runtime.extension.api.loader.ExtensionLoadingContext context)
Determines if the referenced
element should be ignored |
static boolean |
isInstantiable(Class<?> declaringClass,
boolean requireDefaultConstructor,
ReflectionCache reflectionCache) |
static boolean |
isInstantiable(Class<?> declaringClass,
ReflectionCache reflectionCache) |
static boolean |
isInstantiable(org.mule.metadata.api.model.MetadataType type,
ReflectionCache reflectionCache) |
static boolean |
isLifecycle(Class<?> type)
Determines if the given
type implements any of the lifecycle annotations |
static boolean |
isLifecycle(Type type)
Determines if the given
type implements any of the lifecycle annotations |
static boolean |
isLiteral(org.mule.metadata.api.model.MetadataType metadataType) |
static boolean |
isMultiLevelMetadataKeyId(Set<Class<? extends Annotation>> annotations,
org.mule.metadata.api.model.MetadataType parameterType)
Given a
Set of Annotation classes and a MetadataType that describes a component parameter, indicates if the
parameter is considered as a multilevel MetadataKeyId |
static boolean |
isParameterContainer(Set<Class<? extends Annotation>> annotations,
org.mule.metadata.api.model.MetadataType parameterType)
Given a
Set of annotation classes and a MetadataType of a component parameter, indicates if the parameter is
a parameter container. |
static boolean |
isParameterResolver(org.mule.metadata.api.model.MetadataType metadataType) |
static boolean |
isRequired(AccessibleObject object) |
static boolean |
isRequired(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel,
boolean forceOptional) |
static boolean |
isTargetParameter(Set<org.mule.runtime.api.meta.model.ModelProperty> modelProperties) |
static boolean |
isTypedValue(org.mule.metadata.api.model.MetadataType metadataType) |
static boolean |
isVoid(org.mule.runtime.api.meta.model.ComponentModel componentModel) |
static boolean |
isVoid(Method method) |
static boolean |
isVoid(MethodElement methodElement) |
static void |
setValueIntoField(Object target,
Object value,
Field field)
Sets the given
value into the target field |
static void |
setValueIntoField(Object target,
Object value,
String fieldName,
ReflectionCache reflectionCache)
Sets the given
value into the target, if it contains a field named fieldName. |
static org.mule.runtime.api.metadata.DataType |
toDataType(org.mule.metadata.api.model.MetadataType metadataType)
Transforms a
MetadataType and generates the correspondent DataType |
public static org.mule.metadata.api.model.MetadataType getMetadataType(Class<?> type, org.mule.metadata.api.ClassTypeLoader typeLoader)
MetadataType representing the given Class type.type - the Class being introspectedtypeLoader - a ClassTypeLoader used to create the MetadataTypeMetadataTypepublic static org.mule.metadata.api.model.MetadataType getMetadataType(Type type)
public static org.mule.runtime.api.metadata.DataType toDataType(org.mule.metadata.api.model.MetadataType metadataType)
MetadataType and generates the correspondent DataTypemetadataType - to introspect a create a DataType from it.DataType based on the given MetadataTypepublic static boolean isASTMode(org.mule.runtime.api.meta.model.ExtensionModel model)
ExtensionModel, determines if this one has been created using the Java AST.model - Extension model to introspectExtensionModel was created using the Java AST or using compiled classespublic static boolean isASTMode(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration model)
BaseDeclaration, determines if this one has been created using the Java AST.model - Base Declaration to introspectBaseDeclaration was created using the Java AST or using compiled classespublic static org.mule.metadata.api.model.MetadataType getMethodReturnType(MethodElement method)
public static org.mule.metadata.api.model.MetadataType getSourceReturnType(Type returnType)
MetadataType for a source's output.
If the type is a collection of Result instances, then it will return an ArrayType which inner value
represent a Message which payload and attributes matches the types of the Result generics.
returnType - the source output typeMetadataTypepublic static org.mule.metadata.api.model.MetadataType getReturnType(Type returnType)
public static org.mule.metadata.api.model.MetadataType getMethodReturnAttributesType(MethodElement method)
MetadataType representing the Result.getAttributes() that will be set after executing the given
method.
If the method returns a Result, then it returns the type of the Attributes generic. In any other case
(including raw uses of Result) it will return a VoidType
If the method returns a collection or a PagingProvider of Result, then this will return
VoidType since the messages in the main output already contain an attributes for each item.
method - the Method being introspectedMetadataTypeIllegalArgumentException - is method is nullpublic static List<org.mule.metadata.api.model.MetadataType> getGenerics(Type type, org.mule.metadata.api.ClassTypeLoader typeLoader)
public static boolean isLifecycle(Class<?> type)
type implements any of the lifecycle annotationstype - the class to evaluatepublic static boolean isLifecycle(Type type)
type implements any of the lifecycle annotationstype - the class to evaluatepublic static org.mule.metadata.api.model.MetadataType[] getMethodArgumentTypes(Method method, org.mule.metadata.api.ClassTypeLoader typeLoader)
MetadataType representing each of the given Method's argument types.method - a not null MethodtypeLoader - a ClassTypeLoader to be used to create the returned MetadataTypesMetadataType matching the method's arguments. If the method doesn't take any, then the array will
be emptyIllegalArgumentException - is method is nullpublic static org.mule.metadata.api.model.MetadataType getFieldMetadataType(Field field, org.mule.metadata.api.ClassTypeLoader typeLoader)
MetadataType describing the given Field's typefield - a not null FieldtypeLoader - a ClassTypeLoader used to create the MetadataTypeMetadataType matching the field's typeIllegalArgumentException - if field is nullpublic static Optional<Field> getFieldByNameOrAlias(Class<?> clazz, String nameOrAlias, ReflectionCache reflectionCache)
public static Optional<Field> getField(Class<?> clazz, org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel, ReflectionCache reflectionCache)
public static Optional<Field> getField(Class<?> clazz, org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration parameterDeclaration, ReflectionCache reflectionCache)
public static Optional<Field> getField(Class<?> clazz, String name, ReflectionCache reflectionCache)
public static Object getFieldValue(Object object, String fieldName, ReflectionCache reflectionCache) throws IllegalAccessException, NoSuchFieldException
object - The object where grab the field valuefieldName - The name of the field to obtain the valuereflectionCache - the cache for expensive reflection lookupsIllegalAccessException - if is unavailable to access to the fieldNoSuchFieldException - if the field doesn't exist in the given object instancepublic static <T extends org.mule.runtime.api.meta.model.EnrichableModel & org.mule.runtime.api.meta.NamedObject> String getMemberName(T enrichableNamedModel)
public static String getMemberName(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel, String defaultName)
public static Optional<Field> getMemberField(org.mule.runtime.api.meta.model.EnrichableModel enrichableModel)
public static List<Type> getInterfaceGenerics(Type type, Class<?> implementedInterface)
public static List<Class<?>> findGenericsInSuperHierarchy(Class<?> type)
public static List<TypeMirror> getSuperClassGenerics(TypeElement type, Class superClass, ProcessingEnvironment processingEnvironment)
public static List<Type> getSuperClassGenerics(Type currentType, Class<?> superClass)
public static void checkInstantiable(Class<?> declaringClass, ReflectionCache reflectionCache)
public static void checkInstantiable(Class<?> declaringClass, boolean requireDefaultConstructor, ReflectionCache reflectionCache)
public static boolean isInstantiable(org.mule.metadata.api.model.MetadataType type,
ReflectionCache reflectionCache)
public static boolean isInstantiable(Class<?> declaringClass, ReflectionCache reflectionCache)
public static boolean isInstantiable(Class<?> declaringClass, boolean requireDefaultConstructor, ReflectionCache reflectionCache)
public static boolean assignableFromAny(Class<?> type, Collection<Class<?>> matchingTypes)
type is assignable from any of the matchingTypespublic static boolean isRequired(AccessibleObject object)
public static boolean isRequired(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel,
boolean forceOptional)
public static boolean isVoid(Method method)
public static boolean isVoid(org.mule.runtime.api.meta.model.ComponentModel componentModel)
public static boolean isVoid(MethodElement methodElement)
public static Collection<Method> getApiMethods(Class<?> declaringClass)
public static Collection<ExecutableElement> getApiMethods(TypeElement typeElement, ProcessingEnvironment processingEnvironment)
public static boolean isIgnored(WithAnnotations element, org.mule.runtime.extension.api.loader.ExtensionLoadingContext context)
element should be ignoredelement - a WithAnnotations declarationcontext - the introspection ExtensionLoadingContextpublic static Collection<Method> getMethodsAnnotatedWith(Class<?> declaringClass, Class<? extends Annotation> annotationType)
declaringClass which are annotated with annotationType, including those
declared in super classes.declaringClass - the type to introspectannotationType - the annotation you're looking forCollection of Methodspublic static Collection<Method> getMethodsAnnotatedWith(Class<?> declaringClass, Class<? extends Annotation> annotationType, boolean superClasses)
declaringClass which are annotated with annotationTypedeclaringClass - the type to introspectannotationType - the annotation you're looking forsuperClasses - whether to consider supper classes or notCollection of Methodspublic static Stream<ExecutableElement> getMethodsStream(TypeElement typeElement, boolean superClasses, ProcessingEnvironment processingEnvironment)
public static Stream<Field> getAnnotatedFieldsStream(Class<?> clazz, Class<? extends Annotation>... annotationTypes)
Stream with the fields annotated with any of the given annotationTypesclazz - The class to instrospectannotationTypes - the annotation typesStreampublic static List<Field> getAnnotatedFields(Class<?> clazz, Class<? extends Annotation>... annotationTypes)
public static List<VariableElement> getFields(TypeElement typeElement, ProcessingEnvironment processingEnvironment)
public static List<Field> getFieldsOfType(Class<?> introspectedType, Class fieldType)
public static String getAlias(Field field)
Alias or Alias name of the given field.
If the element doesn't have an alias, then the default name is returned
field - the introspected fieldpublic static boolean isConfigOverride(Field field)
field - a fieldfield is a config overridepublic static Optional<Class<?>> getNullSafeDefaultImplementedType(Field field)
public static Collection<Field> getExposedFields(Class<?> extensionType, ReflectionCache reflectionCache)
public static Set<Field> getFieldsWithGetters(Class<?> extensionType, ReflectionCache reflectionCache)
public static List<FieldElement> getFieldsWithGetters(Type extensionType)
public static List<PropertyDescriptor> getPropertyDescriptors(Class<?> extensionType)
public static Optional<org.mule.runtime.api.meta.ExpressionSupport> getExpressionSupport(WithAnnotations annotatedElement, String elementType, String elementName)
public static <T extends Annotation> T getAnnotation(Class<?> annotatedClass, Class<T> annotationClass)
public static Set<Class<?>> getParameterClasses(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, ClassLoader extensionClassLoader)
ParameterModels of the extensionModel and returns the classes that
are modeled by each parameter's Typed.getType().
This includes every single ParameterModel in the model, including configs, providers, operations, etc.
extensionModel - a ExtensionModelnull Setpublic static Set<Class<?>> getSubtypeClasses(org.mule.runtime.api.meta.model.ExtensionModel extensionModel, ClassLoader extensionClassLoader)
object types of the extension model's
SubTypesModel and returns the classes that are used behind of each type.extensionModel - a ExtensionModelnull Setpublic static Set<Class<?>> collectRelativeClasses(org.mule.metadata.api.model.MetadataType type, ClassLoader extensionClassLoader)
MetadataType it adds all the Class that are related from that type. This includes generics of an
ArrayType, open restriction of an ObjectType as well as its fields.type - MetadataType to inspectextensionClassLoader - extension class loaderSet> with the classes reachable from the typepublic static Set<String> collectRelativeClassesAsString(org.mule.metadata.api.model.MetadataType type)
MetadataType it adds all the Class that are related from that type. This includes generics of an
ArrayType, open restriction of an ObjectType as well as its fields.type - MetadataType to inspectSet> with the classes reachable from the typepublic static boolean isMultiLevelMetadataKeyId(Set<Class<? extends Annotation>> annotations, org.mule.metadata.api.model.MetadataType parameterType)
Set of Annotation classes and a MetadataType that describes a component parameter, indicates if the
parameter is considered as a multilevel MetadataKeyIdannotations - of the parameterparameterType - of the parameterMetadataKeyIdpublic static boolean isParameterContainer(Set<Class<? extends Annotation>> annotations, org.mule.metadata.api.model.MetadataType parameterType)
Set of annotation classes and a MetadataType of a component parameter, indicates if the parameter is
a parameter container.
To be a parameter container means that the parameter is a ParameterGroup or a multilevel MetadataKeyId.
annotations - of the component parameterparameterType - of the component parameterpublic static Optional<AnnotatedElement> getAnnotatedElement(org.mule.runtime.api.meta.model.declaration.fluent.BaseDeclaration<?> declaration)
public static String getContainerName(AnnotatedElement container)
public static String getGroupModelContainerName(org.mule.runtime.api.meta.model.parameter.ParameterGroupModel groupModel)
public static String getImplementingName(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration parameterDeclaration)
parameterDeclaration - parameter from which look for their original namepublic static String getImplementingName(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel)
parameterModel - parameter from which look for their original namepublic static boolean isParameterResolver(org.mule.metadata.api.model.MetadataType metadataType)
public static boolean isTargetParameter(Set<org.mule.runtime.api.meta.model.ModelProperty> modelProperties)
public static boolean isLiteral(org.mule.metadata.api.model.MetadataType metadataType)
public static boolean isTypedValue(org.mule.metadata.api.model.MetadataType metadataType)
public static Optional<org.mule.runtime.api.meta.model.connection.ConnectionProviderModel> getConnectionProviderModel(Class<? extends org.mule.runtime.api.connection.ConnectionProvider> connectionProvider, List<org.mule.runtime.api.meta.model.connection.ConnectionProviderModel> allConnectionProviders)
ConnectionProviderModel for a given ConnectionProvider instance.connectionProvider - connection provider classallConnectionProviders - list of available ConnectionProviderModelOptional value of the ConnectionProviderModelpublic static void injectFields(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
String configName,
String encoding,
org.mule.runtime.api.meta.MuleVersion muleVersion)
configName, encoding and MuleVersion into the fields of the target annotated with
RefName, DefaultEncoding and RuntimeVersion respectively if present and the model contains
the DeclaringMemberModelProperty.model - enriched with InjectedFieldModelPropertytarget - object in which the fields are going to be setconfigName - to be injected into the String field annotated with RefNameencoding - to be injected into the String field annotated with DefaultEncodingmuleVersion - to be injected into the MuleVersion field annotated with RuntimeVersionpublic static void injectDefaultEncoding(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
String encoding)
encoding value into the field of the target annotated DefaultEncoding if the model
contains the DeclaringMemberModelProperty property and the value is not null.model - enriched with DefaultEncodingModelPropertytarget - object in which the fields are going to be setencoding - to be injected into the String field annotated with DefaultEncodingpublic static void injectRuntimeVersion(org.mule.runtime.api.meta.model.EnrichableModel model,
Object target,
org.mule.runtime.api.meta.MuleVersion muleVersion)
MuleVersion into the field of the target annotated RuntimeVersion if the model
contains the DeclaringMemberModelProperty property and the value is not null.model - enriched with DefaultEncodingModelPropertytarget - object in which the fields are going to be setmuleVersion - MuleVersion to be injected into the MuleVersion field annotated with
RuntimeVersionpublic static void injectFields(Object target, String configName, String encoding, org.mule.runtime.api.meta.MuleVersion muleVersion, ReflectionCache reflectionCache)
configName, encoding and MuleVersion into the fields of the target annotated with
RefName, DefaultEncoding and RuntimeVersion respectively if present.target - object in which the fields are going to be setconfigName - to be injected into the String field annotated with RefNameencoding - to be injected into the String field annotated with DefaultEncodingmuleVersion - to be injected into the MuleVersion field annotated with RuntimeVersionreflectionCache - the cache for expensive reflection lookupsorg.mule.runtime.extension.api.exception.IllegalModelDefinitionException - if there is more than one field annotated with DefaultEncoding or
RuntimeVersionpublic static void injectRefName(Object target, String configName, ReflectionCache reflectionCache)
target object for a field annotated with RefName or
RefName. If found, it injects the configName value into it.
The target object is expected to have only one field annotated with RefName or
RefName and that field is required to be a String.
target - object in which the value are going to be setconfigName - the value to be injectedreflectionCache - the cache for expensive reflection lookupspublic static Optional<FieldSetter> getDefaultEncodingFieldSetter(Object target, ReflectionCache reflectionCache)
target - object in which the fields are going to be setreflectionCache - the cache for expensive reflection lookupsIllegalModelDefinitionException} - if there is more than one field annotated with DefaultEncodingpublic static Optional<FieldSetter> getRefNameFieldSetter(Object target, ReflectionCache reflectionCache)
target - object in which the fields are going to be setreflectionCache - the cache for expensive reflection lookupsFieldSetterorg.mule.runtime.extension.api.exception.IllegalModelDefinitionException - if there is more than one field annotated with RefName and or
RefNamepublic static void injectComponentLocation(Object target, org.mule.runtime.api.component.location.ComponentLocation componentLocation)
target object for a field of type ComponentLocation. If found, it injects the
componentLocation value into it.
The target object is expected to have only one field of such type.
target - object in which the value are going to be setcomponentLocation - the value to be injectedpublic static org.mule.runtime.api.util.Pair<org.springframework.core.ResolvableType,org.springframework.core.ResolvableType> getPagingProviderTypes(org.springframework.core.ResolvableType pagingProvider)
PagingProvider type and returns their generics.pagingProvider - PagingProvider to introspectPagingProvider generics.public static org.mule.runtime.api.util.Pair<Type,Type> getPagingProviderTypes(Type type)
PagingProvider type and returns their generics.PagingProvider generics.public static Map<String,String> getShowInDslParameters(org.mule.runtime.api.meta.model.parameter.ParameterizedModel parameterizedModel)
ParameterizedModel iterates over all the parameter groups show in dsl and returns a mapping of parameter name
and parameter group name.parameterizedModel - Model to introspect.public static void setValueIntoField(Object target, Object value, String fieldName, ReflectionCache reflectionCache)
value into the target, if it contains a field named fieldName. Nothing happens if such
field doesn't exist.target - the object in which the value is to be setvalue - the value to setfieldName - the name of the target fieldreflectionCache - the ReflectionCache used to introspect the targetpublic static void setValueIntoField(Object target, Object value, Field field)
value into the target fieldtarget - the object in which the value is to be setvalue - the value to setfield - the field in which the value is to be setpublic static Map<org.mule.runtime.api.meta.model.parameter.ParameterGroupModel,Set<org.mule.runtime.api.meta.model.parameter.ParameterModel>> getFilteredParameters(org.mule.runtime.api.meta.model.ComponentModel componentModel, Predicate<org.mule.runtime.api.meta.model.parameter.ParameterModel> filter)
componentModel - the component model used to filter the parametersfilter - the filter to apply to the group model parameterspublic static <T> T getParameterOrDefault(org.mule.runtime.extension.api.runtime.operation.ExecutionContext<? extends org.mule.runtime.api.meta.model.ComponentModel> ctx,
org.mule.runtime.api.meta.model.parameter.ParameterGroupModel parameterGroupModel,
org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel,
T defaultValue,
ReflectionCache reflectionCache)
parameterModel on the group parameterGroupModel or
defaultValue if such parameter is not presentT - the returned value's generic typectx - the execution where to look for the parameterparameterGroupModel - the parameter group where the parameter is definedparameterModel - the parameter model which value will be returneddefaultValue - the default value to return in case the parameter is not presentreflectionCache - the ReflectionCache used to introspect the parameter valuedefaultValuepublic static Object getParameterValue(Object object, org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel, ReflectionCache reflectionCache) throws IllegalAccessException, NoSuchFieldException
object - The object where to grab the parameter value fromparameterModel - The parameter model for the parameter to obtain the valuereflectionCache - the cache for expensive reflection lookupsIllegalAccessException - if is unavailable to access to the fieldNoSuchFieldException - if the field doesn't exist in the given object instancepublic static Optional<Field> fetchConfigFieldFromSourceObject(Object object)
object - the source objectpublic static Optional<Field> fetchConnectionFieldFromSourceObject(Object object)
object - the source objectCopyright © 2003–2022 MuleSoft, Inc.. All rights reserved.