@Override public JavaType getEnclosingTypeName() { return cid.getName(); }
@Override public JavaType getEnclosingTypeName() { return cid.getName(); }
public JavaType getType() { return cid.getName(); }
public void process(final ClassOrInterfaceTypeDetails located) { if (located != null) { types.add(located.getName()); } } });
@Override public String toString() { // Used for example by the "metadata for id" command return getClass().getSimpleName() + " for " + cid.getName(); } }
@Override protected String stringify(final ClassOrInterfaceTypeDetails object) { return object.getName().getSimpleTypeName(); } });
@Override public JavaPackage getCompilationUnitPackage() { return cid.getName().getPackage(); }
/** * Informs if this component can generate service class for required entity * * @param domainType * @return */ public boolean canGenerateService(ClassOrInterfaceTypeDetails domainType) { ClassOrInterfaceTypeDetails repository = repositoryJpaLocator.getFirstRepository(domainType.getName()); if (repository == null) { return false; } return true; }
public void cacheType(final String typeFilePath, final ClassOrInterfaceTypeDetails cid) { Validate.notBlank(typeFilePath, "Module name required"); Validate.notNull(cid, "Type details required"); midToTypeDetailsMap.put(cid.getDeclaredByMetadataId(), cid); typeFilePathToMidMap.put(typeFilePath, cid.getDeclaredByMetadataId()); typeIdentifierToFilePathMap.put(cid.getDeclaredByMetadataId(), typeFilePath); types.add(cid.getName()); final String fullyQualifiedTypeName = cid.getName().getFullyQualifiedTypeName(); final String simpleTypeName = cid.getName().getSimpleTypeName(); typeNameToMidMap.put(fullyQualifiedTypeName, cid.getDeclaredByMetadataId()); if (!simpleTypeNameTypesMap.containsKey(simpleTypeName)) { simpleTypeNameTypesMap.put(simpleTypeName, new HashSet<String>()); } simpleTypeNameTypesMap.get(simpleTypeName).add(fullyQualifiedTypeName); }
public ClassOrInterfaceTypeDetails getDeclaredInnerType(final JavaType typeName) { Validate.notNull(typeName, "Name of inner type required"); for (final ClassOrInterfaceTypeDetails cid : getDeclaredInnerTypes()) { if (cid.getName().getSimpleTypeName().equals(typeName.getSimpleTypeName())) { return cid; } } return null; }
public void addItdTypeDetails(final ItdTypeDetails itdTypeDetails) { if (itdTypeDetails == null || itdTypeDetails.getGovernor() == null) { return; } if (typeMap.get(itdTypeDetails.getGovernor().getName().getFullyQualifiedTypeName()) == null) { typeMap.put(itdTypeDetails.getGovernor().getName().getFullyQualifiedTypeName(), new HashMap<String, MemberHoldingTypeDetails>()); } itdIdToTypeMap.put(itdTypeDetails.getDeclaredByMetadataId(), itdTypeDetails.getGovernor() .getName().getFullyQualifiedTypeName()); typeMap.get(itdTypeDetails.getGovernor().getName().getFullyQualifiedTypeName()).put( itdTypeDetails.getDeclaredByMetadataId(), itdTypeDetails); updateChanges(itdTypeDetails.getGovernor().getName(), false); }
@Override protected void onAddExtendsTypes(final JavaType type) { Validate.isTrue(!governor.getExtendsTypes().contains(type), "Type '%s' already declared in extends types list in target type '%s' (ITD target '%s')", type, governor.getName().getFullyQualifiedTypeName(), aspect.getFullyQualifiedTypeName()); Validate.isTrue(!getExtendsTypes().contains(type), "Type '%s' already declared in extends types list in ITD (ITD target '%s')", type, aspect.getFullyQualifiedTypeName()); }
@Override protected void onAddImplementType(final JavaType type) { Validate .isTrue( !governor.getImplementsTypes().contains(type), "Type '%s' already declared in implements types list in target type '%s' (ITD target '%s')", type, governor.getName().getFullyQualifiedTypeName(), aspect.getFullyQualifiedTypeName()); Validate.isTrue(!getImplementsTypes().contains(type), "Type '%s' already declared in implements types list in ITD (ITD target '%s')", type, aspect.getFullyQualifiedTypeName()); }
@Override public List<String> getModuleNames() { List<String> moduleNames = new ArrayList<String>(); for (ClassOrInterfaceTypeDetails cid : getTypeLocationService() .findClassesOrInterfaceDetailsWithAnnotation( new JavaType("org.springframework.boot.autoconfigure.SpringBootApplication"))) { moduleNames.add(cid.getName().getModule()); } return moduleNames; }
private void init(final ClassOrInterfaceTypeDetails existing) { name = existing.getName(); physicalTypeCategory = existing.getPhysicalTypeCategory(); if (existing.getSuperclass() != null) { superclass = new ClassOrInterfaceTypeDetailsBuilder(existing.getSuperclass()); } enumConstants.addAll(existing.getEnumConstants()); registeredImports.clear(); registeredImports.addAll(existing.getRegisteredImports()); }
public void addModuleDependency(final String moduleName, final JavaType moduleJavaTypeToDependUpon) { if (moduleJavaTypeToDependUpon.getModule() != null) { getProjectOperations() .addModuleDependency(moduleName, moduleJavaTypeToDependUpon.getModule()); } else { ClassOrInterfaceTypeDetails details = getTypeDetails(moduleJavaTypeToDependUpon); if (details != null && details.getName().getModule() != null) { getProjectOperations().addModuleDependency(moduleName, details.getName().getModule()); } } }
@Override protected void onAddField(final FieldMetadataBuilder md) { Validate.isTrue(governor.getDeclaredField(md.getFieldName()) == null, "Field '%s' already defined in target type '%s' (ITD target '%s')", md.getFieldName(), governor.getName().getFullyQualifiedTypeName(), aspect.getFullyQualifiedTypeName()); Validate.isTrue(build().getDeclaredField(md.getFieldName()) == null, "Field '%s' already defined in ITD (ITD target '%s')", md.getFieldName(), aspect.getFullyQualifiedTypeName()); }
@Override protected void onAddAnnotation(final AnnotationMetadataBuilder md) { Validate.isTrue(governor.getAnnotation(md.getAnnotationType()) == null, "Type annotation '%s' already defined in target type '%s' (ITD target '%s')", md.getAnnotationType(), governor.getName().getFullyQualifiedTypeName(), aspect.getFullyQualifiedTypeName()); Validate.isTrue(build().getAnnotation(md.getAnnotationType()) == null, "Type annotation '%s' already defined in ITD (ITD target '%s')", md.getAnnotationType(), aspect.getFullyQualifiedTypeName()); }
@Override public JavaType getDataOnDemand(JavaType entity) { Set<ClassOrInterfaceTypeDetails> dataOnDemandCids = typeLocationService .findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_JPA_DATA_ON_DEMAND); JavaType typeToReturn = null; for (ClassOrInterfaceTypeDetails cid : dataOnDemandCids) { if (entity.equals((JavaType) cid.getAnnotation(RooJavaType.ROO_JPA_DATA_ON_DEMAND) .getAttribute("entity").getValue())) { typeToReturn = cid.getName(); break; } } return typeToReturn; }
private String getEntityFactoryMetadataId(final JavaType javaType, final Iterable<ClassOrInterfaceTypeDetails> entityFactoryTypes) { for (final ClassOrInterfaceTypeDetails cid : entityFactoryTypes) { final AnnotationMetadata entityFactoryAnnotation = cid.getAnnotation(ROO_JPA_ENTITY_FACTORY); final AnnotationAttributeValue<JavaType> entityAttribute = entityFactoryAnnotation.getAttribute("entity"); if (entityAttribute != null && entityAttribute.getValue().equals(javaType)) { // Found the DoD type for the given field's type return JpaDataOnDemandMetadata.createIdentifier(cid.getName(), PhysicalTypeIdentifier.getPath(cid.getDeclaredByMetadataId())); } } return null; }