Package org.glassfish.jersey.message
Class ReaderModel
java.lang.Object
org.glassfish.jersey.message.AbstractEntityProviderModel<MessageBodyReader>
org.glassfish.jersey.message.ReaderModel
MessageBodyReader model.- Since:
- 2.16
- Author:
- Marek Potociar
-
Constructor Summary
ConstructorsConstructorDescriptionReaderModel(MessageBodyReader provider, List<MediaType> types, Boolean custom) Create new reader model instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) Safely invokesisReadablemethod on the underlying provider.Methods inherited from class org.glassfish.jersey.message.AbstractEntityProviderModel
declaredTypes, isCustom, providedType, provider
-
Constructor Details
-
ReaderModel
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@Consumesannotation attached to the provider class.custom- custom flag.
-
-
Method Details
-
isReadable
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) Safely invokesisReadablemethod 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 byMethod.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 byMethod.getParameterAnnotations.mediaType- the media type of the HTTP entity, if one is not specified in the request thenapplication/octet-streamis used.- Returns:
trueif the type is supported, otherwisefalse.
-