use of org.glassfish.hk2.classmodel.reflect.EnumType in project Payara by payara.
the class ApplicationProcessor method vistEnumClass.
private void vistEnumClass(AnnotationModel schemaAnnotation, EnumType enumType, ApiContext context) {
// Get the schema object name
String schemaName = ModelUtils.getSchemaName(context, enumType);
Schema schema = SchemaImpl.createInstance(schemaAnnotation, context);
Schema newSchema = new SchemaImpl();
context.getApi().getComponents().addSchema(schemaName, newSchema);
if (schema != null) {
SchemaImpl.merge(schema, newSchema, true, context);
}
if (schema == null || schema.getEnumeration() == null || schema.getEnumeration().isEmpty()) {
// if the schema annotation does not specify enums, then all enum fields will be added
for (FieldModel enumField : enumType.getStaticFields()) {
final String enumValue = enumField.getName();
if (!enumValue.contains("$VALUES")) {
newSchema.addEnumeration(enumValue);
}
}
}
}
Aggregations