Package org.glassfish.jersey.message
Class WriterModel
- java.lang.Object
-
- org.glassfish.jersey.message.AbstractEntityProviderModel<MessageBodyWriter>
-
- org.glassfish.jersey.message.WriterModel
-
public final class WriterModel extends AbstractEntityProviderModel<MessageBodyWriter>
MessageBodyWritermodel.- Since:
- 2.16
- Author:
- Marek Potociar
-
-
Constructor Summary
Constructors Constructor Description WriterModel(MessageBodyWriter provider, List<MediaType> types, Boolean custom)Create new writer model instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)Safely invokesisWriteablemethod on the underlying provider.-
Methods inherited from class org.glassfish.jersey.message.AbstractEntityProviderModel
declaredTypes, isCustom, providedType, provider
-
-
-
-
Constructor Detail
-
WriterModel
public WriterModel(MessageBodyWriter provider, List<MediaType> types, Boolean custom)
Create new writer model instance. NOTE: This constructor is package-private on purpose.- Parameters:
provider- modelled message body writer instance.types- supported media types as declared in@Consumesannotation attached to the provider class.custom- custom flag.
-
-
Method Detail
-
isWriteable
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
Safely invokesisWriteablemethod on the underlying provider. Any exceptions will be logged at finer level.- Parameters:
type- the class of instance that is to be written.genericType- the type of instance to be written, obtained either by reflection of a resource method return type or via inspection of the returned instance.GenericEntityprovides a way to specify this information at runtime.annotations- an array of the annotations attached to the message entity instance.mediaType- the media type of the HTTP entity.- Returns:
trueif the type is supported, otherwisefalse.
-
-