public class ApplicationJsonFactory extends Object implements MediaTypeFactory
MediaTypeFactory
for Media-Type "application/json" (
MediaType.APPLICATION_JSON
).
CAUTION: This implementation uses field resolution instead of getter/setter
property resolution as of the used marshaling API.MediaTypeAccessor.MediaTypeBuilder<B extends MediaTypeAccessor.MediaTypeBuilder<B>>, MediaTypeAccessor.MediaTypeMutator, MediaTypeAccessor.MediaTypeProperty
Modifier and Type | Field and Description |
---|---|
protected static boolean |
IS_MARSHAL_WITH_VARIABLE_DECLARATION |
Constructor and Description |
---|
ApplicationJsonFactory()
Instantiates a new application json factory.
|
Modifier and Type | Method and Description |
---|---|
MediaType |
getMediaType()
Gets the media type.
|
protected String |
toElementName(Class<?> aClass)
Creates an element name for the class.
|
String |
toMarshaled(Object aObject)
To marshaled.
|
protected String |
toPlainJson(String aJson)
Removes any prefixed variable declaration.
|
protected String |
toUnboxed(String aJson)
Unboxes any enveloped JSON.
|
<T> T |
toUnmarshaled(String aHttpBody,
Class<T> aType)
To unmarshaled.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromMarshaled, fromMarshaled, fromMarshaled, fromMarshaled, fromUnmarshaled, fromUnmarshaled
protected static final boolean IS_MARSHAL_WITH_VARIABLE_DECLARATION
public ApplicationJsonFactory()
public MediaType getMediaType()
getMediaType
in interface MediaTypeAccessor
public String toMarshaled(Object aObject) throws org.refcodes.exception.MarshalException
toMarshaled
in interface org.refcodes.factory.MarshalFactory<String>
aObject
- the a objectorg.refcodes.exception.MarshalException
- the marshal exceptionpublic <T> T toUnmarshaled(String aHttpBody, Class<T> aType) throws org.refcodes.exception.UnmarshalException
toUnmarshaled
in interface org.refcodes.factory.UnmarshalFactory<String>
T
- the generic typeaHttpBody
- the a http bodyaType
- the a typeorg.refcodes.exception.UnmarshalException
- the unmarshal exceptionprotected String toPlainJson(String aJson)
aJson
- The JSON from which to remove any prefixed variable
declaration.protected String toUnboxed(String aJson)
aJson
- The JSON to be unboxed.Copyright © 2017. All rights reserved.