Search in sources :

Example 1 with EnumTypeDefinition

use of com.webcohesion.enunciate.modules.jackson1.model.EnumTypeDefinition in project enunciate by stoicflame.

the class SyntaxImpl method getTypes.

@Override
public List<? extends DataType> getTypes() {
    Collection<TypeDefinition> typeDefinitions = this.context.getTypeDefinitions();
    ArrayList<DataType> dataTypes = new ArrayList<DataType>();
    FacetFilter facetFilter = registrationContext.getFacetFilter();
    for (TypeDefinition typeDefinition : typeDefinitions) {
        if (!facetFilter.accept(typeDefinition)) {
            continue;
        }
        if (typeDefinition instanceof ObjectTypeDefinition) {
            dataTypes.add(new ObjectDataTypeImpl((ObjectTypeDefinition) typeDefinition, registrationContext));
        } else if (typeDefinition instanceof EnumTypeDefinition) {
            dataTypes.add(new EnumDataTypeImpl((EnumTypeDefinition) typeDefinition, registrationContext));
        }
    }
    Collections.sort(dataTypes, new Comparator<DataType>() {

        @Override
        public int compare(DataType o1, DataType o2) {
            return o1.getLabel().compareTo(o2.getLabel());
        }
    });
    return dataTypes;
}
Also used : ObjectTypeDefinition(com.webcohesion.enunciate.modules.jackson1.model.ObjectTypeDefinition) FacetFilter(com.webcohesion.enunciate.facets.FacetFilter) EnumTypeDefinition(com.webcohesion.enunciate.modules.jackson1.model.EnumTypeDefinition) TypeDefinition(com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition) EnumTypeDefinition(com.webcohesion.enunciate.modules.jackson1.model.EnumTypeDefinition) ObjectTypeDefinition(com.webcohesion.enunciate.modules.jackson1.model.ObjectTypeDefinition)

Aggregations

FacetFilter (com.webcohesion.enunciate.facets.FacetFilter)1 EnumTypeDefinition (com.webcohesion.enunciate.modules.jackson1.model.EnumTypeDefinition)1 ObjectTypeDefinition (com.webcohesion.enunciate.modules.jackson1.model.ObjectTypeDefinition)1 TypeDefinition (com.webcohesion.enunciate.modules.jackson1.model.TypeDefinition)1