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
Constructor and Description |
---|
ApplicationJsonFactory()
Instantiates a new application JSON factory.
|
Modifier and Type | Method and Description |
---|---|
MediaType |
getMediaType()
Retrieves the Media-Type from the Media-Type property.
|
protected String |
toElementName(Class<?> aClass)
Creates an element name for the class.
|
String |
toMarshaled(Object aObject)
This method creates / retrieves an instance of the given type with the
given identifier (name) constructed as defined in one to many
configuration files.
|
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)
This method creates / retrieves an instance of the given type from the
provided instance.
|
protected String |
toVariableDeclaration(Class<?> aClass)
Returns the JSON specific assignment declaration for the given class.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromMarshaled, fromMarshaled, fromMarshaled, fromMarshaled, fromUnmarshaled, fromUnmarshaled
toUnmarshaled, toUnmarshaled, toUnmarshaled
toMarshaled
public ApplicationJsonFactory()
public MediaType getMediaType()
getMediaType
in interface MediaTypeAccessor
public String toMarshaled(Object aObject) throws org.refcodes.exception.MarshalException
toMarshaled
in interface Marshalable<String>
aObject
- The context which may influence the object being created
by this factory.org.refcodes.exception.MarshalException
- Thrown when marshaling / serializing an object
fails.public <T> T toUnmarshaled(String aHttpBody, Class<T> aType) throws org.refcodes.exception.UnmarshalException
toUnmarshaled
in interface Unmarshalable<String>
T
- The type which is to be fabricated by the factory method.aHttpBody
- The context which may influence the object being created
by this factory.aType
- The type identifying the instance to be created / retrieved.org.refcodes.exception.UnmarshalException
- Thrown when unmarshaling / deserializing an
object fails.protected 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.protected String toElementName(Class<?> aClass)
aClass
- The class from which to retrieve the element name.Copyright © 2017. All rights reserved.