public class ApplicationJsonFactory extends Object implements MediaTypeFactory
MediaTypeFactory
for Media-Type "application/json".
CAUTION: This implementation uses field resolution instead of getter/setter
property resolution!MediaTypeAccessor.MediaTypeBuilder<B extends MediaTypeAccessor.MediaTypeBuilder<B>>, MediaTypeAccessor.MediaTypeMutator, MediaTypeAccessor.MediaTypeProperty
Constructor and Description |
---|
ApplicationJsonFactory() |
Modifier and Type | Method and Description |
---|---|
MediaType |
getMediaType()
Retrieves the Media-Type from the Media-Type property.
|
String |
toMarshaled(Object aObject)
Marshals an object to an HTP body as of the according
MediaType
specified by MediaTypeAccessor.getMediaType() . |
<T> T |
toUnmarshaled(String aHttpBody,
Class<T> aType)
Unmarshals an object to an HTP body as of the according
MediaType
specified by MediaTypeAccessor.getMediaType() . |
public MediaType getMediaType()
MediaTypeAccessor
getMediaType
in interface MediaTypeAccessor
public String toMarshaled(Object aObject) throws org.refcodes.exception.MarshalException
MediaTypeFactory
MediaType
specified by MediaTypeAccessor.getMediaType()
.toMarshaled
in interface org.refcodes.factory.MarshalFactory<String>
toMarshaled
in interface MediaTypeFactory
aObject
- The object to be converted to an HTTP body.MediaType
.org.refcodes.exception.MarshalException
public <T> T toUnmarshaled(String aHttpBody, Class<T> aType) throws org.refcodes.exception.UnmarshalException
MediaTypeFactory
MediaType
specified by MediaTypeAccessor.getMediaType()
.toUnmarshaled
in interface org.refcodes.factory.UnmarshalFactory<String>
toUnmarshaled
in interface MediaTypeFactory
aHttpBody
- The HTTP body to be converted to an instance of the
given type.aType
- The type being expected from unmarshaling the provided HTTP
body.MediaType
.org.refcodes.exception.UnmarshalException
Copyright © 2016. All rights reserved.