java.lang.String |
getAttributePrefix()
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
providers
MOXyJsonProvider
public MOXyJsonProvider()
getAttributePrefix
public java.lang.String getAttributePrefix()
- The value that will be prepended to all keys that are mapped to an XML
attribute. By default there is no attribute prefix.
- See Also:
org.eclipse.persistence.jaxb.MarshallerPropertes.JSON_ATTRIBUTE_PREFIX ,
org.eclipse.persistence.jaxb.UnmarshallerPropertes.JSON_ATTRIBUTE_PREFIX
getDomainClass
protected java.lang.Class<?> getDomainClass(java.lang.reflect.Type genericType)
- A convenience method to get the domain class (i.e. Customer) from
the parameter/return type (i.e. Customer or List<Customer>).
- Parameters:
genericType - - The parameter/return type of the JAX-RS operation.
- Returns:
- The corresponding domain class.
getJAXBContext
protected JAXBContext getJAXBContext(java.lang.Class<?> domainClass,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
httpHeaders)
throws JAXBException
- Return the JAXBContext that corresponds to the domain class. This
method does the following:
- If an EclipseLink JAXB (MOXy) JAXBContext is available from
a ContextResolver then use it.
- If an existing JAXBContext was not found in step one, then
create a new one on the domain class.
- Parameters:
domainClass - - The domain class we need a JAXBContext for.annotations - - The annotations corresponding to domain object.mediaType - - The media type for the HTTP entity.httpHeaders - - HTTP headers associated with HTTP entity.
- Returns:
-
- Throws:
JAXBException
getNamespacePrefixMapper
public java.util.Map<java.lang.String,java.lang.String> getNamespacePrefixMapper()
- By default the JSON-binding will ignore namespace qualification. If this
property is set the portion of the key before the namespace separator
will be used to determine the namespace URI.
- See Also:
org.eclipse.persistence.jaxb.MarshallerProperties.NAMESPACE_PREFIX_MAPPER ,
org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_NAMESPACE_PREFIX_MAPPER
getNamespaceSeparator
public char getNamespaceSeparator()
- This character (default is '.') separates the prefix from the key name.
It is only used if namespace qualification has been enabled be setting a
namespace prefix mapper.
- See Also:
org.eclipse.persistence.jaxb.MarshallerProperties.NAMESPACE_SEPARATOR ,
org.eclipse.persistence.jaxb.UnmarshallerProperties.NAMESPACE_SEPARATOR
getSize
public long getSize(java.lang.Object t,
java.lang.Class<?> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
getValueWrapper
public java.lang.String getValueWrapper()
- The key that will correspond to the property mapped with @XmlValue. This
key will only be used if there are other mapped properties.
- See Also:
org.eclipse.persistence.jaxb.MarshallerPropertes.JSON_VALUE_WRAPPER ,
org.eclipse.persistence.jaxb.UnmarshallerPropertes.JSON_VALUE_WRAPPER
isFormattedOutput
public boolean isFormattedOutput()
- Returns:
- true if the JSON output should be formatted (default is false).
isIncludeRoot
public boolean isIncludeRoot()
- Returns:
- true if the root node is included in the JSON message (default is
false).
- See Also:
org.eclipse.persistence.jaxb.MarshallerPropertes.JSON_INCLUDE_ROOT ,
org.eclipse.persistence.jaxb.UnmarshallerPropertes.JSON_INCLUDE_ROOT
isMarshalEmptyCollections
public boolean isMarshalEmptyCollections()
- If true empty collections will be marshalled as empty arrays, else the
collection will not be marshalled to JSON (default is true).
- See Also:
org.eclipse.persistence.jaxb.MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS
isReadable
public boolean isReadable(java.lang.Class<?> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
- This method will return true for all inputs. This means that
MOXyJsonProvider will always be used for the JSON binding.
- Returns:
- true
isWriteable
public boolean isWriteable(java.lang.Class<?> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
- This method will return true for all inputs. This means that
MOXyJsonProvider will always be used for the JSON binding.
- Returns:
- true
preReadFrom
protected void preReadFrom(java.lang.Class<java.lang.Object> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
httpHeaders,
Unmarshaller unmarshaller)
throws JAXBException
- Subclasses of MOXyJsonProvider can override this method to
customize the instance of Unmarshaller that will be used to
unmarshal the JSON message in the readFrom call.
- Parameters:
type - - The Class to be unmarshalled (i.e. Customer or
List)genericType - - The type of object to be unmarshalled (i.e
Customer or List<Customer>).annotations - - The annotations corresponding to domain object.mediaType - - The media type for the HTTP entity.httpHeaders - - HTTP headers associated with HTTP entity.unmarshaller - - The instance of Unmarshaller that will be
used to unmarshal the JSON message.
- Throws:
JAXBException - See Also:
UnmarshallerProperties
preWriteTo
protected void preWriteTo(java.lang.Object object,
java.lang.Class<?> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
httpHeaders,
Marshaller marshaller)
throws JAXBException
- Subclasses of MOXyJsonProvider can override this method to
customize the instance of Marshaller that will be used to marshal
the domain objects to JSON in the writeTo call.
- Parameters:
object - - The domain object that will be marshalled to JSON.type - - The Class to be marshalled (i.e. Customer or
List)genericType - - The type of object to be marshalled (i.e
Customer or List<Customer>).annotations - - The annotations corresponding to domain object.mediaType - - The media type for the HTTP entity.httpHeaders - - HTTP headers associated with HTTP entity.marshaller - - The instance of Marshaller that will be used
to marshal the domain object to JSON.
- Throws:
JAXBException - See Also:
MarshallerProperties
readFrom
public final java.lang.Object readFrom(java.lang.Class<java.lang.Object> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
httpHeaders,
java.io.InputStream entityStream)
throws java.io.IOException,
WebApplicationException
- Throws:
java.io.IOException
WebApplicationException
setAttributePrefix
public void setAttributePrefix(java.lang.String attributePrefix)
- Specify a value that will be prepended to all keys that are mapped to an
XML attribute. By default there is no attribute prefix.
- See Also:
org.eclipse.persistence.jaxb.MarshallerPropertes.JSON_ATTRIBUTE_PREFIX ,
org.eclipse.persistence.jaxb.UnmarshallerPropertes.JSON_ATTRIBUTE_PREFIX
setFormattedOutput
public void setFormattedOutput(boolean formattedOutput)
- Specify if the JSON output should be formatted (default is false).
- Parameters:
formattedOutput - - true if the output should be formatted, else
false.
setIncludeRoot
public void setIncludeRoot(boolean includeRoot)
- Specify if the root node should be included in the JSON message (default
is false).
- Parameters:
includeRoot - - true if the message includes the root node, else
false.- See Also:
org.eclipse.persistence.jaxb.MarshallerPropertes.JSON_INCLUDE_ROOT ,
org.eclipse.persistence.jaxb.UnmarshallerPropertes.JSON_INCLUDE_ROOT
setMarshalEmptyCollections
public void setMarshalEmptyCollections(boolean marshalEmptyCollections)
- If true empty collections will be marshalled as empty arrays, else the
collection will not be marshalled to JSON (default is true).
- See Also:
org.eclipse.persistence.jaxb.MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS
setNamespacePrefixMapper
public void setNamespacePrefixMapper(java.util.Map<java.lang.String,java.lang.String> namespacePrefixMapper)
- By default the JSON-binding will ignore namespace qualification. If this
property is set then a prefix corresponding to the namespace URI and a
namespace separator will be prefixed to the key.
include it you can specify a Map of namespace URI to prefix.
- See Also:
org.eclipse.persistence.jaxb.MarshallerProperties.NAMESPACE_PREFIX_MAPPER ,
org.eclipse.persistence.jaxb.UnmarshallerProperties.JSON_NAMESPACE_PREFIX_MAPPER
setNamespaceSeparator
public void setNamespaceSeparator(char namespaceSeparator)
- This character (default is '.') separates the prefix from the key name.
It is only used if namespace qualification has been enabled be setting a
namespace prefix mapper.
- See Also:
org.eclipse.persistence.jaxb.MarshallerProperties.NAMESPACE_SEPARATOR ,
org.eclipse.persistence.jaxb.UnmarshallerProperties.NAMESPACE_SEPARATOR
setValueWrapper
public void setValueWrapper(java.lang.String valueWrapper)
- Specify the key that will correspond to the property mapped with
- See Also:
org.eclipse.persistence.jaxb.MarshallerPropertes.JSON_VALUE_WRAPPER ,
org.eclipse.persistence.jaxb.UnmarshallerPropertes.JSON_VALUE_WRAPPER
writeTo
public final void writeTo(java.lang.Object object,
java.lang.Class<?> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
httpHeaders,
java.io.OutputStream entityStream)
throws java.io.IOException,
WebApplicationException
- Throws:
java.io.IOException
WebApplicationException
|