use of org.springframework.roo.classpath.details.MemberHoldingTypeDetails in project spring-roo by spring-projects.
the class RepositoryJpaMetadataProviderImpl method getLocalMidToRequest.
@Override
protected String getLocalMidToRequest(final ItdTypeDetails itdTypeDetails) {
// Determine the governor for this ITD, and whether any metadata is even
// hoping to hear about changes to that JavaType and its ITDs
final JavaType governor = itdTypeDetails.getName();
final String localMid = domainTypeToRepositoryMidMap.get(governor);
if (localMid != null) {
return localMid;
}
final MemberHoldingTypeDetails memberHoldingTypeDetails = getTypeLocationService().getTypeDetails(governor);
if (memberHoldingTypeDetails != null) {
for (final JavaType type : memberHoldingTypeDetails.getLayerEntities()) {
final String localMidType = domainTypeToRepositoryMidMap.get(type);
if (localMidType != null) {
return localMidType;
}
}
}
return null;
}
use of org.springframework.roo.classpath.details.MemberHoldingTypeDetails in project spring-roo by spring-projects.
the class PartTreeUnitTest method setUp.
@Before
public void setUp() throws IllegalArgumentException, IllegalAccessException {
List<FieldMetadata> declaredFields = new ArrayList<FieldMetadata>();
declaredFields.add(new DefaultFieldMetadata(new CustomDataImpl(new HashMap<Object, Object>()), "text", 0, null, new JavaSymbolName("text"), new JavaType(String.class), null));
declaredFields.add(new DefaultFieldMetadata(new CustomDataImpl(new HashMap<Object, Object>()), "number", 0, null, new JavaSymbolName("number"), new JavaType(Integer.class), null));
declaredFields.add(new DefaultFieldMetadata(new CustomDataImpl(new HashMap<Object, Object>()), "date", 0, null, new JavaSymbolName("date"), new JavaType(Date.class), null));
declaredFields.add(new DefaultFieldMetadata(new CustomDataImpl(new HashMap<Object, Object>()), "enumer", 0, null, new JavaSymbolName("enumer"), new JavaType(Enum.class), null));
declaredFields.add(new DefaultFieldMetadata(new CustomDataImpl(new HashMap<Object, Object>()), "primitiveInt", 0, null, new JavaSymbolName("primitiveInt"), JavaType.INT_PRIMITIVE, null));
final List<MemberHoldingTypeDetails> memberHoldingTypeDetails = new ArrayList<MemberHoldingTypeDetails>();
memberHoldingTypeDetails.add(new DefaultClassOrInterfaceTypeDetails(new CustomDataImpl(new HashMap<Object, Object>()), "Example", 0, null, new JavaType("Example"), PhysicalTypeCategory.CLASS, null, declaredFields, null, null, null, null, null, null, null, null));
memberDetails = new MemberDetailsImpl(memberHoldingTypeDetails);
}
use of org.springframework.roo.classpath.details.MemberHoldingTypeDetails in project spring-roo by spring-projects.
the class RepositoryJpaCustomMetadataProviderImpl method getLocalMidToRequest.
@Override
protected String getLocalMidToRequest(final ItdTypeDetails itdTypeDetails) {
// Determine the governor for this ITD, and whether any metadata is even
// hoping to hear about changes to that JavaType and its ITDs
final JavaType governor = itdTypeDetails.getName();
final String localMid = domainTypeToRepositoryMidMap.get(governor);
if (localMid != null) {
return localMid;
}
final MemberHoldingTypeDetails memberHoldingTypeDetails = getTypeLocationService().getTypeDetails(governor);
if (memberHoldingTypeDetails != null) {
for (final JavaType type : memberHoldingTypeDetails.getLayerEntities()) {
final String localMidType = domainTypeToRepositoryMidMap.get(type);
if (localMidType != null) {
return localMidType;
}
}
}
return null;
}
use of org.springframework.roo.classpath.details.MemberHoldingTypeDetails in project spring-roo by spring-projects.
the class MemberDetailsBuilder method doModification.
private void doModification(final ConstructorMetadata constructor, final CustomData customData) {
final MemberHoldingTypeDetails memberHoldingTypeDetails = memberHoldingTypeDetailsMap.get(constructor.getDeclaredByMetadataId());
if (memberHoldingTypeDetails != null) {
final ConstructorMetadata matchedConstructor = memberHoldingTypeDetails.getDeclaredConstructor(AnnotatedJavaType.convertFromAnnotatedJavaTypes(constructor.getParameterTypes()));
if (matchedConstructor != null && !matchedConstructor.getCustomData().keySet().containsAll(customData.keySet())) {
final TypeDetailsBuilder typeDetailsBuilder = getTypeDetailsBuilder(memberHoldingTypeDetails);
typeDetailsBuilder.addDataToConstructor(constructor, customData);
changed = true;
}
}
}
use of org.springframework.roo.classpath.details.MemberHoldingTypeDetails in project spring-roo by spring-projects.
the class MemberDetailsBuilder method doModification.
private void doModification(final MethodMetadata method, final CustomData customData) {
final MemberHoldingTypeDetails memberHoldingTypeDetails = memberHoldingTypeDetailsMap.get(method.getDeclaredByMetadataId());
if (memberHoldingTypeDetails != null) {
final MethodMetadata matchedMethod = memberHoldingTypeDetails.getMethod(method.getMethodName(), AnnotatedJavaType.convertFromAnnotatedJavaTypes(method.getParameterTypes()));
if (matchedMethod != null && !matchedMethod.getCustomData().keySet().containsAll(customData.keySet())) {
final TypeDetailsBuilder typeDetailsBuilder = getTypeDetailsBuilder(memberHoldingTypeDetails);
typeDetailsBuilder.addDataToMethod(method, customData);
changed = true;
}
}
}
Aggregations