@Override public PhysicalTypeCategory getPhysicalTypeCategory() { return cid.getPhysicalTypeCategory(); } };
@Override public PhysicalTypeCategory getPhysicalTypeCategory() { return cid.getPhysicalTypeCategory(); } };
/** * Indicates whether the given type is the governor for this provider. This * implementation simply checks whether the given type is either a class or * an interface, based on the value of {@link #dependsOnGovernorBeingAClass} * . A more sophisticated implementation could check for the presence of * particular annotations or the implementation of particular interfaces. * * @param type can be <code>null</code> * @return <code>false</code> if the given type is <code>null</code> */ protected boolean isGovernor(final ClassOrInterfaceTypeDetails type) { if (type == null) { return false; } if (dependsOnGovernorBeingAClass) { return type.getPhysicalTypeCategory() == PhysicalTypeCategory.CLASS; } return type.getPhysicalTypeCategory() == PhysicalTypeCategory.INTERFACE; }
private Collection<JavaType> getTypesForModule(final String optionContext, final Pom targetModule) { final Collection<JavaType> typesForModule = typeLocationService.getTypesForModule(targetModule); if (!(optionContext.contains(SUPERCLASS) || optionContext.contains(INTERFACE) || optionContext .contains(ENUMERATION))) { return typesForModule; } final Collection<JavaType> types = new ArrayList<JavaType>(); for (final JavaType javaType : typesForModule) { final ClassOrInterfaceTypeDetails typeDetails = typeLocationService.getTypeDetails(javaType); if ((optionContext.contains(SUPERCLASS) && (Modifier.isFinal(typeDetails.getModifier()) || typeDetails .getPhysicalTypeCategory() == PhysicalTypeCategory.INTERFACE)) || (optionContext.contains(INTERFACE) && typeDetails.getPhysicalTypeCategory() != PhysicalTypeCategory.INTERFACE) || (optionContext.contains(ENUMERATION) && typeDetails.getPhysicalTypeCategory() != PhysicalTypeCategory.ENUMERATION)) { continue; } types.add(javaType); } return types; }
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()); }
/** * This method checks if the provided type is enum or not * * @param fieldType * @return */ private boolean isEnumType(FieldMetadata field) { Validate.notNull(field, "Java type required"); final JavaType fieldType = field.getFieldType(); if (fieldType.isPrimitive()) { return false; } if (STANDAR_TYPES.contains(fieldType) || DATE_TIME_TYPES.contains(fieldType)) { return false; } if (field.getAnnotation(JpaJavaType.ENUMERATED) != null) { return true; } final ClassOrInterfaceTypeDetails javaTypeDetails = getTypeLocationService().getTypeDetails(fieldType); return javaTypeDetails != null && javaTypeDetails.getPhysicalTypeCategory().equals(PhysicalTypeCategory.ENUMERATION); }
Validate.isTrue(cid.getPhysicalTypeCategory() == PhysicalTypeCategory.CLASS, "Type %s is not a class", entity.getFullyQualifiedTypeName()); Validate.isTrue(!Modifier.isAbstract(cid.getModifier()), "Type %s is abstract",
@Override public void createEnumField(ClassOrInterfaceTypeDetails cid, JavaType fieldType, JavaSymbolName fieldName, String column, boolean notNull, boolean nullRequired, EnumType enumType, String comment, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) { ClassOrInterfaceTypeDetails typeDetails = typeLocationService.getTypeDetails(fieldType); Validate.isTrue(typeDetails.getPhysicalTypeCategory() == PhysicalTypeCategory.ENUMERATION, "The field type is not an enum class."); final String physicalTypeIdentifier = cid.getDeclaredByMetadataId(); final EnumField fieldDetails = new EnumField(physicalTypeIdentifier, fieldType, fieldName); if (column != null) { fieldDetails.setColumn(column); } fieldDetails.setNotNull(notNull); fieldDetails.setNullRequired(nullRequired); if (enumType != null) { fieldDetails.setEnumType(enumType); } if (comment != null) { fieldDetails.setComment(comment); } if (extraAnnotations != null && !extraAnnotations.isEmpty()) { fieldDetails.addAnnotations(extraAnnotations); } insertField(fieldDetails, permitReservedWords, transientModifier); }
@Override public void createEnumField(ClassOrInterfaceTypeDetails cid, JavaType fieldType, JavaSymbolName fieldName, String column, boolean notNull, boolean nullRequired, EnumType enumType, String comment, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) { ClassOrInterfaceTypeDetails typeDetails = typeLocationService.getTypeDetails(fieldType); Validate.isTrue(typeDetails.getPhysicalTypeCategory() == PhysicalTypeCategory.ENUMERATION, "The field type is not an enum class."); final String physicalTypeIdentifier = cid.getDeclaredByMetadataId(); final EnumField fieldDetails = new EnumField(physicalTypeIdentifier, fieldType, fieldName); if (column != null) { fieldDetails.setColumn(column); } fieldDetails.setNotNull(notNull); fieldDetails.setNullRequired(nullRequired); if (enumType != null) { fieldDetails.setEnumType(enumType); } if (comment != null) { fieldDetails.setComment(comment); } if (extraAnnotations != null && !extraAnnotations.isEmpty()) { fieldDetails.addAnnotations(extraAnnotations); } insertField(fieldDetails, permitReservedWords, transientModifier); }
new DefaultPhysicalTypeMetadata(metadataIdentificationString, canonicalPath, typeDetails); final ClassOrInterfaceTypeDetails details = result.getMemberHoldingTypeDetails(); if (details != null && details.getPhysicalTypeCategory() == PhysicalTypeCategory.CLASS && details.getExtendsTypes().size() == 1) {
getTypeLocationService().getTypeDetails(fieldType); if (javaTypeDetails != null && javaTypeDetails.getPhysicalTypeCategory().equals(PhysicalTypeCategory.ENUMERATION)) { List<JavaSymbolName> enumConstants = javaTypeDetails.getEnumConstants(); for (JavaSymbolName constant : enumConstants) {
Validate.isTrue(cid.getPhysicalTypeCategory() == PhysicalTypeCategory.CLASS, "Type %s is not a class", currentEntity.getFullyQualifiedTypeName()); Validate.isTrue(!Modifier.isAbstract(cid.getModifier()), "Type %s is abstract",
if (childCid.getPhysicalTypeCategory() == PhysicalTypeCategory.ENUMERATION) { isEnumeration = true; } else if (entityAnnotation != null || persistentAnnotation != null) {
/** * Indicates whether the given type is the governor for this provider. This * implementation simply checks whether the given type is either a class or * an interface, based on the value of {@link #dependsOnGovernorBeingAClass} * . A more sophisticated implementation could check for the presence of * particular annotations or the implementation of particular interfaces. * * @param type can be <code>null</code> * @return <code>false</code> if the given type is <code>null</code> */ protected boolean isGovernor(final ClassOrInterfaceTypeDetails type) { if (type == null) { return false; } if (dependsOnGovernorBeingAClass) { return type.getPhysicalTypeCategory() == PhysicalTypeCategory.CLASS; } return type.getPhysicalTypeCategory() == PhysicalTypeCategory.INTERFACE; }
appendFields(); appendConstructors(); appendMethods(itdTypeDetails.getGovernor().getPhysicalTypeCategory() .equals(PhysicalTypeCategory.INTERFACE)); appendInnerTypes();
if (cid.getPhysicalTypeCategory() == PhysicalTypeCategory.INTERFACE || cid.getPhysicalTypeCategory() == PhysicalTypeCategory.CLASS) { final boolean isInterface = cid.getPhysicalTypeCategory() == PhysicalTypeCategory.INTERFACE;
&& typeDetails.getPhysicalTypeCategory().equals(PhysicalTypeCategory.ENUMERATION)) {
&& cid.getPhysicalTypeCategory() != PhysicalTypeCategory.CLASS) { produceMetadata = false;
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()); }
@Override public void createEnumField(ClassOrInterfaceTypeDetails cid, JavaType fieldType, JavaSymbolName fieldName, String column, boolean notNull, boolean nullRequired, EnumType enumType, String comment, boolean permitReservedWords, boolean transientModifier, List<AnnotationMetadataBuilder> extraAnnotations) { ClassOrInterfaceTypeDetails typeDetails = typeLocationService.getTypeDetails(fieldType); Validate.isTrue(typeDetails.getPhysicalTypeCategory() == PhysicalTypeCategory.ENUMERATION, "The field type is not an enum class."); final String physicalTypeIdentifier = cid.getDeclaredByMetadataId(); final EnumField fieldDetails = new EnumField(physicalTypeIdentifier, fieldType, fieldName); if (column != null) { fieldDetails.setColumn(column); } fieldDetails.setNotNull(notNull); fieldDetails.setNullRequired(nullRequired); if (enumType != null) { fieldDetails.setEnumType(enumType); } if (comment != null) { fieldDetails.setComment(comment); } if (extraAnnotations != null && !extraAnnotations.isEmpty()) { fieldDetails.addAnnotations(extraAnnotations); } insertField(fieldDetails, permitReservedWords, transientModifier); }