Class ReaderModel


  • public final class ReaderModel
    extends AbstractEntityProviderModel<javax.ws.rs.ext.MessageBodyReader>
    MessageBodyReader model.
    Since:
    2.16
    • Constructor Summary

      Constructors 
      Constructor Description
      ReaderModel​(javax.ws.rs.ext.MessageBodyReader provider, java.util.List<javax.ws.rs.core.MediaType> types, java.lang.Boolean custom)
      Create new reader model instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isReadable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Safely invokes isReadable method on the underlying provider.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReaderModel

        public ReaderModel​(javax.ws.rs.ext.MessageBodyReader provider,
                           java.util.List<javax.ws.rs.core.MediaType> types,
                           java.lang.Boolean custom)
        Create new reader model instance. NOTE: This constructor is package-private on purpose.
        Parameters:
        provider - modelled message body reader instance.
        types - supported media types as declared in @Consumes annotation attached to the provider class.
        custom - custom flag.
    • Method Detail

      • isReadable

        public boolean isReadable​(java.lang.Class<?> type,
                                  java.lang.reflect.Type genericType,
                                  java.lang.annotation.Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
        Safely invokes isReadable method on the underlying provider. Any exceptions will be logged at finer level.
        Parameters:
        type - the class of instance to be produced.
        genericType - the type of instance to be produced. E.g. if the message body is to be converted into a method parameter, this will be the formal type of the method parameter as returned by Method.getGenericParameterTypes.
        annotations - an array of the annotations on the declaration of the artifact that will be initialized with the produced instance. E.g. if the message body is to be converted into a method parameter, this will be the annotations on that parameter returned by Method.getParameterAnnotations.
        mediaType - the media type of the HTTP entity, if one is not specified in the request then application/octet-stream is used.
        Returns:
        true if the type is supported, otherwise false.