Class MarkupMultilineAdapter
- 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<MarkupMultiline>
-
- gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter
-
- All Implemented Interfaces:
IDataTypeAdapter<MarkupMultiline>
public class MarkupMultilineAdapter extends AbstractMarkupAdapter<MarkupMultiline>
-
-
Field Summary
-
Fields inherited from class gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter
DEFAULT_JSON_FIELD_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandleQName(QName nextQName)
Determines if adapter can parse the next element.String
getDefaultJsonValueKey()
Gets the default value to use as the JSON/YAML field name for a Metaschema field value if no JSON value key flag or name is configured.Class<IMarkupItem>
getItemClass()
Get the java type of the associated item.List<String>
getNames()
Get the metaschema type names associated with this adapter.boolean
isUnrappedValueAllowedInXml()
Determines if the data type's value is allowed to be unwrapped in XML when the value is a field value.IMarkupItem
newItem(Object value)
Construct a new item of this type using the provided value.MarkupMultiline
parse(com.fasterxml.jackson.core.JsonParser parser)
This default implementation will parse the value as a string and delegate to the string-based parsing method.MarkupMultiline
parse(String value)
Parse a line of Markdown.MarkupMultiline
parse(org.codehaus.stax2.XMLEventReader2 eventReader)
This method is expected to parse content starting at the next event.-
Methods inherited from class gov.nist.secauto.metaschema.core.datatype.markup.AbstractMarkupAdapter
getJsonRawType, isXmlMixed, writeJsonValue, writeXmlValue, writeXmlValue
-
Methods inherited from class gov.nist.secauto.metaschema.core.datatype.AbstractCustomJavaDataTypeAdapter
copy
-
Methods inherited from class gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter
asString, cast, castInternal, getJavaClass, isParsingStartElement, 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
getPreferredName, isAtomic, parseAndSupply, parseAndSupply, parseAndSupply
-
-
-
-
Method Detail
-
getNames
public List<String> getNames()
Description copied from interface:IDataTypeAdapter
Get the metaschema type names associated with this adapter. This name must be unique with respect to all other metaschema types.At least one name must be provided, with the first name being the most preferred name.
- Returns:
- the name
-
isUnrappedValueAllowedInXml
public boolean isUnrappedValueAllowedInXml()
Description copied from interface:IDataTypeAdapter
Determines if the data type's value is allowed to be unwrapped in XML when the value is a field value.- Specified by:
isUnrappedValueAllowedInXml
in interfaceIDataTypeAdapter<MarkupMultiline>
- Overrides:
isUnrappedValueAllowedInXml
in classAbstractDataTypeAdapter<MarkupMultiline,IMarkupItem>
- Returns:
true
if allowed, orfalse
otherwise.
-
parse
public MarkupMultiline parse(String value)
Parse a line of Markdown.- Parameters:
value
- the string value to parse- Returns:
- the parsed data as the adapter's type
-
parse
public MarkupMultiline parse(org.codehaus.stax2.XMLEventReader2 eventReader) throws IOException
Description copied from interface:IDataTypeAdapter
This method is expected to parse content starting at the next event. Parsing will continue until the next event represents content that is not handled by this adapter. This means the event stream should be positioned after anyXMLStreamConstants.END_ELEMENT
that corresponds to anXMLStreamConstants.START_ELEMENT
parsed by this adapter.If
IDataTypeAdapter.isParsingStartElement()
returnstrue
, then the first event to parse will be theXMLStreamConstants.START_ELEMENT
for the element that contains the value data, then the value data. If this is the case, this method must also parse the correspondingXMLStreamConstants.END_ELEMENT
. Otherwise, the first event to parse will be the value data.The value data is expected to be parsed completely, leaving the event stream on a peeked event corresponding to content that is not handled by this method.
- Specified by:
parse
in interfaceIDataTypeAdapter<MarkupMultiline>
- Overrides:
parse
in classAbstractDataTypeAdapter<MarkupMultiline,IMarkupItem>
- Parameters:
eventReader
- the XML parser used to read the parsed value- Returns:
- the parsed value
- Throws:
IOException
- if a parsing error occurs
-
parse
public MarkupMultiline parse(com.fasterxml.jackson.core.JsonParser parser) throws IOException
Description copied from class:AbstractDataTypeAdapter
This default implementation will parse the value as a string and delegate to the string-based parsing method.- Specified by:
parse
in interfaceIDataTypeAdapter<MarkupMultiline>
- Overrides:
parse
in classAbstractDataTypeAdapter<MarkupMultiline,IMarkupItem>
- Parameters:
parser
- the JSON parser used to read the parsed value- Returns:
- the parsed value
- Throws:
IOException
- if a parsing error occurs
-
canHandleQName
public boolean canHandleQName(QName nextQName)
Description copied from interface:IDataTypeAdapter
Determines if adapter can parse the next element. The next element'sQName
is provided for this purpose.This will be called when the parser encounter's an element it does not recognize. This gives the adapter a chance to request parsing of the data.
- Specified by:
canHandleQName
in interfaceIDataTypeAdapter<MarkupMultiline>
- Overrides:
canHandleQName
in classAbstractDataTypeAdapter<MarkupMultiline,IMarkupItem>
- Parameters:
nextQName
- the next element's namespace-qualified name- Returns:
true
if the adapter will parse the element, orfalse
otherwise
-
getDefaultJsonValueKey
public String getDefaultJsonValueKey()
Description copied from interface:IDataTypeAdapter
Gets the default value to use as the JSON/YAML field name for a Metaschema field value if no JSON value key flag or name is configured.- Specified by:
getDefaultJsonValueKey
in interfaceIDataTypeAdapter<MarkupMultiline>
- Overrides:
getDefaultJsonValueKey
in classAbstractDataTypeAdapter<MarkupMultiline,IMarkupItem>
- Returns:
- the default field name to use
-
getItemClass
public Class<IMarkupItem> getItemClass()
Description copied from interface:IDataTypeAdapter
Get the java type of the associated item.- Specified by:
getItemClass
in interfaceIDataTypeAdapter<MarkupMultiline>
- Specified by:
getItemClass
in classAbstractDataTypeAdapter<MarkupMultiline,IMarkupItem>
- Returns:
- the java associated item type
-
newItem
public IMarkupItem newItem(Object value)
Description copied from interface:IDataTypeAdapter
Construct a new item of this type using the provided value.- Specified by:
newItem
in interfaceIDataTypeAdapter<MarkupMultiline>
- Specified by:
newItem
in classAbstractDataTypeAdapter<MarkupMultiline,IMarkupItem>
- Parameters:
value
- the item's value- Returns:
- a new item
-
-