@Override protected void onAddConstructor(final ConstructorMetadataBuilder md) { Validate.isTrue(governor.getDeclaredConstructor(AnnotatedJavaType .convertFromAnnotatedJavaTypes(md.getParameterTypes())) == null, "Constructor with %d parameters already defined in target type '%s' (ITD target '%s')", md .getParameterTypes().size(), governor.getName().getFullyQualifiedTypeName(), aspect .getFullyQualifiedTypeName()); Validate.isTrue( build().getDeclaredConstructor( AnnotatedJavaType.convertFromAnnotatedJavaTypes(md.getParameterTypes())) == null, "Constructor with %d parameters already defined in ITD (ITD target '%s')", md .getParameterTypes().size(), aspect.getFullyQualifiedTypeName()); Validate .notBlank( md.getBody(), "Constructor '%s' failed to provide a body, despite being identified for ITD inclusion", md); }
/** * Ensures that the governor has provided constructor * * @param ConstructorMetadataBuilder the constructor to include(required) * @since 2.0 */ protected final void ensureGovernorHasConstructor( final ConstructorMetadataBuilder constructorMetadata) { if (governorTypeDetails.getDeclaredConstructor(AnnotatedJavaType .convertFromAnnotatedJavaTypes(constructorMetadata.getParameterTypes())) == null) { builder.addConstructor(constructorMetadata); } }
public void addDataToConstructor(final ConstructorMetadata replacement, final CustomData customData) { // If the MIDs don't match then the proposed can't be a replacement if (!replacement.getDeclaredByMetadataId().equals(getDeclaredByMetadataId())) { return; } for (final ConstructorMetadataBuilder existingConstructor : getDeclaredConstructors()) { if (AnnotatedJavaType .convertFromAnnotatedJavaTypes(existingConstructor.getParameterTypes()).equals( AnnotatedJavaType.convertFromAnnotatedJavaTypes(replacement.getParameterTypes()))) { for (final Object key : customData.keySet()) { existingConstructor.putCustomData(key, customData.get(key)); } break; } } }
/** * Constructor * * @param identifier * @param aspectName * @param governorPhysicalTypeMetadata */ public EntityProjectionMetadata(final String identifier, final JavaType aspectName, final PhysicalTypeMetadata governorPhysicalTypeMetadata, final EntityProjectionAnnotationValues annotationValues, final List<FieldMetadata> fields) { super(identifier, aspectName, governorPhysicalTypeMetadata); Validate .isTrue( isValid(identifier), "Metadata identification string '%s' does not appear to be a valid physical type identifier", identifier); this.fields = fields; this.annotationValues = annotationValues; this.type = governorPhysicalTypeMetadata.getType(); ConstructorMetadataBuilder constructorMetadata = getConstructor(); if (!constructorMetadata.getParameterTypes().isEmpty()) { ensureGovernorHasConstructor(constructorMetadata); } // ROO-3868: New entity visualization support using a new format annotation ensureGovernorIsAnnotated(new AnnotationMetadataBuilder(getEntityFormatAnnotation())); // Build ITD itdTypeDetails = builder.build(); }
/** * Constructor * * @param identifier * @param aspectName * @param governorPhysicalTypeMetadata */ public DtoMetadata(final String identifier, final JavaType aspectName, final PhysicalTypeMetadata governorPhysicalTypeMetadata, final DtoAnnotationValues annotationValues, List<FieldMetadata> fields) { super(identifier, aspectName, governorPhysicalTypeMetadata); Validate .isTrue( isValid(identifier), "Metadata identification string '%s' does not appear to be a valid physical type identifier", identifier); this.annotationValues = annotationValues; this.fields = fields; this.type = governorPhysicalTypeMetadata.getType(); if (annotationValues.getImmutable()) { ConstructorMetadataBuilder constructorMetadata = getConstructor(); if (!constructorMetadata.getParameterTypes().isEmpty()) { ensureGovernorHasConstructor(constructorMetadata); } } // ROO-3868: New entity visualization support using a new format annotation ensureGovernorIsAnnotated(new AnnotationMetadataBuilder(getEntityFormatAnnotation())); // Build ITD itdTypeDetails = builder.build(); }
public ConstructorMetadata build() { return new DefaultConstructorMetadata(getCustomData().build(), getDeclaredByMetadataId(), getModifier(), buildAnnotations(), getParameterTypes(), getParameterNames(), getThrowsTypes(), getBodyBuilder().getOutput()); } }
for (final ConstructorMetadataBuilder targetConstructor : targetBuilder .getDeclaredConstructors()) { if (targetConstructor.getParameterTypes().equals(constructor.getParameterTypes())) { continue constructorAdditions;
@Override protected void onAddConstructor(final ConstructorMetadataBuilder md) { Validate.isTrue(governor.getDeclaredConstructor(AnnotatedJavaType .convertFromAnnotatedJavaTypes(md.getParameterTypes())) == null, "Constructor with %d parameters already defined in target type '%s' (ITD target '%s')", md .getParameterTypes().size(), governor.getName().getFullyQualifiedTypeName(), aspect .getFullyQualifiedTypeName()); Validate.isTrue( build().getDeclaredConstructor( AnnotatedJavaType.convertFromAnnotatedJavaTypes(md.getParameterTypes())) == null, "Constructor with %d parameters already defined in ITD (ITD target '%s')", md .getParameterTypes().size(), aspect.getFullyQualifiedTypeName()); Validate .notBlank( md.getBody(), "Constructor '%s' failed to provide a body, despite being identified for ITD inclusion", md); }
/** * Ensures that the governor has provided constructor * * @param ConstructorMetadataBuilder the constructor to include(required) * @since 2.0 */ protected final void ensureGovernorHasConstructor( final ConstructorMetadataBuilder constructorMetadata) { if (governorTypeDetails.getDeclaredConstructor(AnnotatedJavaType .convertFromAnnotatedJavaTypes(constructorMetadata.getParameterTypes())) == null) { builder.addConstructor(constructorMetadata); } }
public void addDataToConstructor(final ConstructorMetadata replacement, final CustomData customData) { // If the MIDs don't match then the proposed can't be a replacement if (!replacement.getDeclaredByMetadataId().equals(getDeclaredByMetadataId())) { return; } for (final ConstructorMetadataBuilder existingConstructor : getDeclaredConstructors()) { if (AnnotatedJavaType .convertFromAnnotatedJavaTypes(existingConstructor.getParameterTypes()).equals( AnnotatedJavaType.convertFromAnnotatedJavaTypes(replacement.getParameterTypes()))) { for (final Object key : customData.keySet()) { existingConstructor.putCustomData(key, customData.get(key)); } break; } } }
/** * Constructor * * @param identifier * @param aspectName * @param governorPhysicalTypeMetadata */ public EntityProjectionMetadata(final String identifier, final JavaType aspectName, final PhysicalTypeMetadata governorPhysicalTypeMetadata, final EntityProjectionAnnotationValues annotationValues, final List<FieldMetadata> fields) { super(identifier, aspectName, governorPhysicalTypeMetadata); Validate .isTrue( isValid(identifier), "Metadata identification string '%s' does not appear to be a valid physical type identifier", identifier); this.fields = fields; this.annotationValues = annotationValues; this.type = governorPhysicalTypeMetadata.getType(); ConstructorMetadataBuilder constructorMetadata = getConstructor(); if (!constructorMetadata.getParameterTypes().isEmpty()) { ensureGovernorHasConstructor(constructorMetadata); } // ROO-3868: New entity visualization support using a new format annotation ensureGovernorIsAnnotated(new AnnotationMetadataBuilder(getEntityFormatAnnotation())); // Build ITD itdTypeDetails = builder.build(); }
/** * Constructor * * @param identifier * @param aspectName * @param governorPhysicalTypeMetadata */ public DtoMetadata(final String identifier, final JavaType aspectName, final PhysicalTypeMetadata governorPhysicalTypeMetadata, final DtoAnnotationValues annotationValues, List<FieldMetadata> fields) { super(identifier, aspectName, governorPhysicalTypeMetadata); Validate .isTrue( isValid(identifier), "Metadata identification string '%s' does not appear to be a valid physical type identifier", identifier); this.annotationValues = annotationValues; this.fields = fields; this.type = governorPhysicalTypeMetadata.getType(); if (annotationValues.getImmutable()) { ConstructorMetadataBuilder constructorMetadata = getConstructor(); if (!constructorMetadata.getParameterTypes().isEmpty()) { ensureGovernorHasConstructor(constructorMetadata); } } // ROO-3868: New entity visualization support using a new format annotation ensureGovernorIsAnnotated(new AnnotationMetadataBuilder(getEntityFormatAnnotation())); // Build ITD itdTypeDetails = builder.build(); }
public ConstructorMetadata build() { return new DefaultConstructorMetadata(getCustomData().build(), getDeclaredByMetadataId(), getModifier(), buildAnnotations(), getParameterTypes(), getParameterNames(), getThrowsTypes(), getBodyBuilder().getOutput()); } }
for (final ConstructorMetadataBuilder targetConstructor : targetBuilder .getDeclaredConstructors()) { if (targetConstructor.getParameterTypes().equals(constructor.getParameterTypes())) { continue constructorAdditions;