Search in sources :

Example 6 with Syntax

use of com.webcohesion.enunciate.api.datatype.Syntax in project enunciate by stoicflame.

the class StatusCodeImpl method getMediaTypes.

@Override
public List<? extends MediaTypeDescriptor> getMediaTypes() {
    ArrayList<MediaTypeDescriptor> mts = new ArrayList<MediaTypeDescriptor>();
    DecoratedTypeMirror type = this.responseCode.getType();
    if (type != null) {
        RequestMapping requestMapping = this.responseCode.getRequestMapping();
        Set<String> produces = requestMapping.getProducesMediaTypes();
        for (String mt : produces) {
            for (Syntax syntax : requestMapping.getContext().getContext().getApiRegistry().getSyntaxes(this.registrationContext)) {
                MediaTypeDescriptor descriptor = syntax.findMediaTypeDescriptor(mt, type);
                if (descriptor != null) {
                    mts.add(descriptor);
                }
            }
        }
    }
    return mts;
}
Also used : MediaTypeDescriptor(com.webcohesion.enunciate.api.resources.MediaTypeDescriptor) DecoratedTypeMirror(com.webcohesion.enunciate.javac.decorations.type.DecoratedTypeMirror) ArrayList(java.util.ArrayList) Syntax(com.webcohesion.enunciate.api.datatype.Syntax) RequestMapping(com.webcohesion.enunciate.modules.spring_web.model.RequestMapping)

Aggregations

Syntax (com.webcohesion.enunciate.api.datatype.Syntax)6 ResourceApi (com.webcohesion.enunciate.api.resources.ResourceApi)3 ServiceApi (com.webcohesion.enunciate.api.services.ServiceApi)3 MediaTypeDescriptor (com.webcohesion.enunciate.api.resources.MediaTypeDescriptor)2 FacetFilter (com.webcohesion.enunciate.facets.FacetFilter)2 DecoratedTypeMirror (com.webcohesion.enunciate.javac.decorations.type.DecoratedTypeMirror)2 ArrayList (java.util.ArrayList)2 EnunciateException (com.webcohesion.enunciate.EnunciateException)1 ApiRegistrationContext (com.webcohesion.enunciate.api.ApiRegistrationContext)1 ApiRegistry (com.webcohesion.enunciate.api.ApiRegistry)1 DataType (com.webcohesion.enunciate.api.datatype.DataType)1 Namespace (com.webcohesion.enunciate.api.datatype.Namespace)1 Property (com.webcohesion.enunciate.api.datatype.Property)1 Value (com.webcohesion.enunciate.api.datatype.Value)1 Method (com.webcohesion.enunciate.api.resources.Method)1 ResourceGroup (com.webcohesion.enunciate.api.resources.ResourceGroup)1 Operation (com.webcohesion.enunciate.api.services.Operation)1 Service (com.webcohesion.enunciate.api.services.Service)1 ServiceGroup (com.webcohesion.enunciate.api.services.ServiceGroup)1 Artifact (com.webcohesion.enunciate.artifacts.Artifact)1