private void addImplementingTypeModelProperty(AnnotatedElement element, ParameterDeclarer parameter) { parameter.withModelProperty(element instanceof Field ? new DeclaringMemberModelProperty(((Field) element)) : new ImplementingParameterModelProperty((java.lang.reflect.Parameter) element)); }
private void parseExclusiveOptional(ExtensionParameter extensionParameter, ParameterGroupDeclarer parameterGroupDeclarer, ParameterDeclarer parameter) { ParameterGroupDeclaration groupDeclaration = (ParameterGroupDeclaration) parameterGroupDeclarer.getDeclaration(); List<ExclusiveParametersDeclaration> exclusiveParameters = groupDeclaration.getExclusiveParameters(); exclusiveParameters.stream() .filter(group -> group.getParameterNames().contains(extensionParameter.getAlias())) .findFirst() .ifPresent(exclusiveParametersDeclaration -> { ExclusiveParametersModel exclusiveParametersModel = new ImmutableExclusiveParametersModel(exclusiveParametersDeclaration.getParameterNames(), exclusiveParametersDeclaration.isRequiresOne()); parameter.withModelProperty(new ExclusiveOptionalModelProperty(exclusiveParametersModel)); }); }
void declareParameters(ComponentDeclarer component, List<ExtensionParameter> methodParameters, List<ExtensionParameter> fieldParameters, ParameterDeclarationContext declarationContext) { loader.getMethodParametersLoader().declare(component, methodParameters, declarationContext); loader.getFieldParametersLoader().declare(component, fieldParameters, declarationContext).forEach(p -> { p.withExpressionSupport(NOT_SUPPORTED); p.withModelProperty(new FieldOperationParameterModelProperty()); }); }
/** * {@inheritDoc} */ @Override public void contribute(ExtensionParameter parameter, ParameterDeclarer declarer, ParameterDeclarationContext declarationContext) { getInfrastructureType(parameter.getType()).ifPresent(infrastructureType -> { if (!isBlank(infrastructureType.getName())) { declarer.withModelProperty(new InfrastructureParameterModelProperty(infrastructureType.getSequence())); declarer.withExpressionSupport(NOT_SUPPORTED); getQName(infrastructureType.getName()).ifPresent(declarer::withModelProperty); getDslConfiguration(infrastructureType.getName()).ifPresent(declarer::withDsl); } }); } }
/** * 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)); }
/** * Contributes to a {@link ParameterDeclarer} if the type of the given parameter is one of the registered * as {@link StackableType wrapper types} * * @param parameter {@link ExtensionParameter} with introspected information of the Java parameter * @param declarer declarer to be enriched * @param declarationContext context of the parameter to be declared */ @Override public void contribute(ExtensionParameter parameter, ParameterDeclarer declarer, ParameterDeclarationContext declarationContext) { LazyValue<StackedTypesModelProperty.Builder> stackedTypesModelPropertyBuilder = new LazyValue<>(StackedTypesModelProperty::builder); doContribute(parameter, declarationContext, parameter.getType(), stackedTypesModelPropertyBuilder); declarer.ofType(parameter.getType().asMetadataType()); stackedTypesModelPropertyBuilder.ifComputed(builder -> declarer.withModelProperty(builder.build())); }
parameter.withModelProperty(new NullSafeModelProperty(nullSafeType)); if (hasDefaultOverride) { parameter.withModelProperty(new DefaultImplementingTypeModelProperty(nullSafeType));
parseLayout(extensionParameter, parameter); parseExclusiveOptional(extensionParameter, groupDeclarer, parameter); parameter.withModelProperty(new ExtensionParameterDescriptorModelProperty(extensionParameter)); extensionParameter.getDeclaringElement().ifPresent(element -> addImplementingTypeModelProperty(element, parameter)); parseParameterDsl(extensionParameter, parameter);
private void addImplementingTypeModelProperty(AnnotatedElement element, ParameterDeclarer parameter) { parameter.withModelProperty(element instanceof Field ? new DeclaringMemberModelProperty(((Field) element)) : new ImplementingParameterModelProperty((java.lang.reflect.Parameter) element)); }
private void parseExclusiveOptional(ExtensionParameter extensionParameter, ParameterGroupDeclarer parameterGroupDeclarer, ParameterDeclarer parameter) { ParameterGroupDeclaration groupDeclaration = (ParameterGroupDeclaration) parameterGroupDeclarer.getDeclaration(); List<ExclusiveParametersDeclaration> exclusiveParameters = groupDeclaration.getExclusiveParameters(); exclusiveParameters.stream() .filter(group -> group.getParameterNames().contains(extensionParameter.getAlias())) .findFirst() .ifPresent(exclusiveParametersDeclaration -> { ExclusiveParametersModel exclusiveParametersModel = new ImmutableExclusiveParametersModel(exclusiveParametersDeclaration.getParameterNames(), exclusiveParametersDeclaration.isRequiresOne()); parameter.withModelProperty(new ExclusiveOptionalModelProperty(exclusiveParametersModel)); }); }
void declareParameters(ComponentDeclarer component, List<ExtensionParameter> methodParameters, List<ExtensionParameter> fieldParameters, ParameterDeclarationContext declarationContext) { loader.getMethodParametersLoader().declare(component, methodParameters, declarationContext); loader.getFieldParametersLoader().declare(component, fieldParameters, declarationContext).forEach(p -> { p.withExpressionSupport(NOT_SUPPORTED); p.withModelProperty(new FieldOperationParameterModelProperty()); }); }
/** * {@inheritDoc} */ @Override public void contribute(ExtensionParameter parameter, ParameterDeclarer declarer, ParameterDeclarationContext declarationContext) { getInfrastructureType(parameter.getType()).ifPresent(infrastructureType -> { if (!isBlank(infrastructureType.getName())) { declarer.withModelProperty(new InfrastructureParameterModelProperty(infrastructureType.getSequence())); declarer.withExpressionSupport(NOT_SUPPORTED); getQName(infrastructureType.getName()).ifPresent(declarer::withModelProperty); getDslConfiguration(infrastructureType.getName()).ifPresent(declarer::withDsl); } }); } }
/** * Contributes to a {@link ParameterDeclarer} if the type of the given parameter is one of the registered * as {@link StackableType wrapper types} * * @param parameter {@link ExtensionParameter} with introspected information of the Java parameter * @param declarer declarer to be enriched * @param declarationContext context of the parameter to be declared */ @Override public void contribute(ExtensionParameter parameter, ParameterDeclarer declarer, ParameterDeclarationContext declarationContext) { LazyValue<StackedTypesModelProperty.Builder> stackedTypesModelPropertyBuilder = new LazyValue<>(StackedTypesModelProperty::builder); doContribute(parameter, declarationContext, parameter.getType(), stackedTypesModelPropertyBuilder); declarer.ofType(parameter.getType().asMetadataType()); stackedTypesModelPropertyBuilder.ifComputed(builder -> declarer.withModelProperty(builder.build())); }
parameter.withModelProperty(new NullSafeModelProperty(nullSafeType)); if (hasDefaultOverride) { parameter.withModelProperty(new DefaultImplementingTypeModelProperty(nullSafeType));
parseLayout(extensionParameter, parameter); parseExclusiveOptional(extensionParameter, groupDeclarer, parameter); parameter.withModelProperty(new ExtensionParameterDescriptorModelProperty(extensionParameter)); extensionParameter.getDeclaringElement().ifPresent(element -> addImplementingTypeModelProperty(element, parameter)); parseParameterDsl(extensionParameter, parameter);