Search in sources :

Example 1 with DeclaringMemberModelProperty

use of org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty in project mule by mulesoft.

the class IntrospectionUtils method getAnnotatedElement.

public static java.util.Optional<AnnotatedElement> getAnnotatedElement(BaseDeclaration<?> declaration) {
    final java.util.Optional<DeclaringMemberModelProperty> declaringMember = declaration.getModelProperty(DeclaringMemberModelProperty.class);
    final java.util.Optional<ImplementingParameterModelProperty> implementingParameter = declaration.getModelProperty(ImplementingParameterModelProperty.class);
    AnnotatedElement annotatedElement = null;
    if (declaringMember.isPresent()) {
        annotatedElement = declaringMember.get().getDeclaringField();
    }
    if (implementingParameter.isPresent()) {
        annotatedElement = implementingParameter.get().getParameter();
    }
    return java.util.Optional.ofNullable(annotatedElement);
}
Also used : DeclaringMemberModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty) AnnotatedElement(java.lang.reflect.AnnotatedElement) ImplementingParameterModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ImplementingParameterModelProperty)

Example 2 with DeclaringMemberModelProperty

use of org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty in project mule by mulesoft.

the class SoapInvokeOperationDeclarer method declareMetadataKeyParameters.

/**
 * Given the Invoke Operation Declarer declares all the parameters that the operation has.
 *
 * @param operation the invoke operation declarer.
 */
private void declareMetadataKeyParameters(OperationDeclarer operation, ClassTypeLoader loader, ReflectionCache reflectionCache) {
    TypeWrapper keyType = new TypeWrapper(WebServiceTypeKey.class, loader);
    ParameterGroupDeclarer group = operation.onParameterGroup(KEYS_GROUP).withModelProperty(new ParameterGroupModelProperty(new ParameterGroupDescriptor(KEYS_GROUP, keyType)));
    StringType stringType = TYPE_BUILDER.stringType().build();
    group.withRequiredParameter(SERVICE_PARAM).withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, SERVICE_PARAM, reflectionCache).get())).ofType(stringType).withModelProperty(new MetadataKeyPartModelProperty(1)).withLayout(getLayout(1));
    group.withRequiredParameter(OPERATION_PARAM).ofType(stringType).withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, OPERATION_PARAM, reflectionCache).get())).withModelProperty(new MetadataKeyPartModelProperty(2)).withLayout(getLayout(2));
}
Also used : DeclaringMemberModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty) TypeWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper) StringType(org.mule.metadata.api.model.StringType) WebServiceTypeKey(org.mule.runtime.extension.api.soap.WebServiceTypeKey) ParameterGroupDescriptor(org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor) ParameterGroupModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty) MetadataKeyPartModelProperty(org.mule.runtime.extension.api.property.MetadataKeyPartModelProperty) ParameterGroupDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclarer)

Example 3 with DeclaringMemberModelProperty

use of org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty in project mule by mulesoft.

the class MetadataKeyIdObjectResolverTestCase method mockDeclaringMemberModelProp.

private void mockDeclaringMemberModelProp(ParameterModel param, String name, ReflectionCache reflectionCache) {
    Field f = getField(LocationKey.class, name, reflectionCache).get();
    when(param.getModelProperty(DeclaringMemberModelProperty.class)).thenReturn(of(new DeclaringMemberModelProperty(f)));
}
Also used : DeclaringMemberModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty) IntrospectionUtils.getField(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getField) Field(java.lang.reflect.Field) LocationKey(org.mule.test.metadata.extension.LocationKey)

Aggregations

DeclaringMemberModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.DeclaringMemberModelProperty)3 AnnotatedElement (java.lang.reflect.AnnotatedElement)1 Field (java.lang.reflect.Field)1 StringType (org.mule.metadata.api.model.StringType)1 ParameterGroupDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclarer)1 MetadataKeyPartModelProperty (org.mule.runtime.extension.api.property.MetadataKeyPartModelProperty)1 WebServiceTypeKey (org.mule.runtime.extension.api.soap.WebServiceTypeKey)1 ParameterGroupDescriptor (org.mule.runtime.module.extension.internal.loader.ParameterGroupDescriptor)1 ImplementingParameterModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ImplementingParameterModelProperty)1 ParameterGroupModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty)1 TypeWrapper (org.mule.runtime.module.extension.internal.loader.java.type.runtime.TypeWrapper)1 IntrospectionUtils.getField (org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getField)1 LocationKey (org.mule.test.metadata.extension.LocationKey)1