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);
}
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));
}
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)));
}
Aggregations