Class AbstractMarkupAdapter<TYPE extends IMarkupString<TYPE>>
- java.lang.Object
-
- gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter<TYPE,ITEM_TYPE>
-
- gov.nist.secauto.metaschema.core.datatype.AbstractCustomJavaDataTypeAdapter<TYPE,IMarkupItem>
-
- gov.nist.secauto.metaschema.core.datatype.markup.AbstractMarkupAdapter<TYPE>
-
- All Implemented Interfaces:
IDataTypeAdapter<TYPE>
- Direct Known Subclasses:
MarkupLineAdapter
,MarkupMultilineAdapter
public abstract class AbstractMarkupAdapter<TYPE extends IMarkupString<TYPE>> extends AbstractCustomJavaDataTypeAdapter<TYPE,IMarkupItem>
-
-
Field Summary
-
Fields inherited from class gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter
DEFAULT_JSON_FIELD_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMarkupAdapter(Class<TYPE> clazz)
Construct a new adapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes
getJsonRawType()
The JSON primative type of the data type.boolean
isXmlMixed()
Determines if the datatype uses mixed text and element content in XML.void
writeJsonValue(Object value, com.fasterxml.jackson.core.JsonGenerator generator)
Writes the provided Java class instance as a JSON/YAML field value.void
writeXmlValue(Object value, QName parentName, org.codehaus.stax2.XMLStreamWriter2 streamWriter)
Writes the provided Java class instance data as XML.void
writeXmlValue(Object value, StartElement parent, org.codehaus.stax2.evt.XMLEventFactory2 eventFactory, XMLEventWriter eventWriter)
Writes the provided Java class instance data as XML.-
Methods inherited from class gov.nist.secauto.metaschema.core.datatype.AbstractCustomJavaDataTypeAdapter
copy
-
Methods inherited from class gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter
asString, canHandleQName, cast, castInternal, getDefaultJsonValueKey, getItemClass, getJavaClass, isParsingStartElement, isUnrappedValueAllowedInXml, newItem, parse, parse, toValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nist.secauto.metaschema.core.datatype.IDataTypeAdapter
getNames, getPreferredName, isAtomic, parse, parseAndSupply, parseAndSupply, parseAndSupply
-
-
-
-
Constructor Detail
-
AbstractMarkupAdapter
protected AbstractMarkupAdapter(@NonNull Class<TYPE> clazz)
Construct a new adapter.- Parameters:
clazz
- the markup type class
-
-
Method Detail
-
getJsonRawType
public com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes getJsonRawType()
Description copied from interface:IDataTypeAdapter
The JSON primative type of the data type.- Returns:
- the JSON data type
-
isXmlMixed
public boolean isXmlMixed()
Description copied from interface:IDataTypeAdapter
Determines if the datatype uses mixed text and element content in XML.- Specified by:
isXmlMixed
in interfaceIDataTypeAdapter<TYPE extends IMarkupString<TYPE>>
- Overrides:
isXmlMixed
in classAbstractDataTypeAdapter<TYPE extends IMarkupString<TYPE>,IMarkupItem>
- Returns:
true
if the datatype uses mixed text and element content in XML, orfalse
otherwise
-
writeXmlValue
public void writeXmlValue(Object value, StartElement parent, org.codehaus.stax2.evt.XMLEventFactory2 eventFactory, XMLEventWriter eventWriter) throws XMLStreamException
Description copied from interface:IDataTypeAdapter
Writes the provided Java class instance data as XML. The parent element information is provided as aStartElement
event, which allows namespace information to be obtained from the parent element using theStartElement.getName()
andStartElement.getNamespaceContext()
methods, which can be used when writing the provided instance value.- Specified by:
writeXmlValue
in interfaceIDataTypeAdapter<TYPE extends IMarkupString<TYPE>>
- Overrides:
writeXmlValue
in classAbstractDataTypeAdapter<TYPE extends IMarkupString<TYPE>,IMarkupItem>
- Parameters:
value
- theField
instance value to writeparent
- theStartElement
XML event that is the parent of the data to writeeventFactory
- the XML event factory used to generate XML writing eventseventWriter
- the XML writer used to output XML as events- Throws:
XMLStreamException
- if an unexpected error occurred while processing the XML output
-
writeXmlValue
public void writeXmlValue(Object value, QName parentName, org.codehaus.stax2.XMLStreamWriter2 streamWriter) throws XMLStreamException
Description copied from interface:IDataTypeAdapter
Writes the provided Java class instance data as XML. The parent element information is provided as an XMLQName
, which allows namespace information to be obtained from the parent element. Additional namespace information can be gathered using theXMLStreamWriter.getNamespaceContext()
method, which can be used when writing the provided instance value.- Specified by:
writeXmlValue
in interfaceIDataTypeAdapter<TYPE extends IMarkupString<TYPE>>
- Overrides:
writeXmlValue
in classAbstractDataTypeAdapter<TYPE extends IMarkupString<TYPE>,IMarkupItem>
- Parameters:
value
- theField
instance value to writeparentName
- the qualified name of the XML data's parent elementstreamWriter
- the XML writer used to output the XML data- Throws:
XMLStreamException
- if an unexpected error occurred while processing the XML output
-
writeJsonValue
public void writeJsonValue(Object value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
Description copied from interface:IDataTypeAdapter
Writes the provided Java class instance as a JSON/YAML field value.- Specified by:
writeJsonValue
in interfaceIDataTypeAdapter<TYPE extends IMarkupString<TYPE>>
- Overrides:
writeJsonValue
in classAbstractDataTypeAdapter<TYPE extends IMarkupString<TYPE>,IMarkupItem>
- Parameters:
value
- theField
instance value to writegenerator
- the JSON/YAML writer used to output the JSON/YAML data- Throws:
IOException
- if an unexpected error occurred while writing the JSON/YAML output
-
-