Class JsonValueParser<T>
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.lex.json.JsonValueParser<T>
-
- All Implemented Interfaces:
ValueParser<T>
,Serializable
public class JsonValueParser<T> extends Object implements ValueParser<T>, Serializable
TODO what about thread safety?- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JsonValueParser(@NotNull com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.node.ValueNode node, PrismNamespaceContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Element
asDomElement()
boolean
canParseAs(QName typeName)
Checks if this parser can (by itself) parse the value as given type.ValueParser<T>
freeze()
Map<String,String>
getPotentiallyRelevantNamespaces()
Returns namespaces that could be relevant when serializing unparsed string value of this item.String
getStringValue()
Returns the value represented as string - in the best format that we can.boolean
isEmpty()
T
parse(QName typeName, XNodeProcessorEvaluationMode mode)
String
toString()
-
-
-
Constructor Detail
-
JsonValueParser
public JsonValueParser(@NotNull @NotNull com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.node.ValueNode node, PrismNamespaceContext context)
-
-
Method Detail
-
parse
public T parse(QName typeName, XNodeProcessorEvaluationMode mode) throws SchemaException
- Specified by:
parse
in interfaceValueParser<T>
- Throws:
SchemaException
-
canParseAs
public boolean canParseAs(QName typeName)
Description copied from interface:ValueParser
Checks if this parser can (by itself) parse the value as given type. (If it cannot, the parsing must be done by higher layers.) This method should be efficient. It may bring some performance penalty (when coupled with following parse() call) but we assume this situation is quite rare and performance effect is negligible.- Specified by:
canParseAs
in interfaceValueParser<T>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceValueParser<T>
-
getStringValue
public String getStringValue()
Description copied from interface:ValueParser
Returns the value represented as string - in the best format that we can. This has to work even without knowing the exact data type. Therefore there is no guarantee that the returned value will be precise. This method is used as a "last instance" if everything else fails. Invocation of this method will not change the state of the xnode, e.g. it will NOT cause it to be parsed. It can be invoked without any side effects.- Specified by:
getStringValue
in interfaceValueParser<T>
-
getPotentiallyRelevantNamespaces
public Map<String,String> getPotentiallyRelevantNamespaces()
Description copied from interface:ValueParser
Returns namespaces that could be relevant when serializing unparsed string value of this item. Used to preserve xmlns declarations for QNames and ItemPaths in unparsed data. (MID-2196)- Specified by:
getPotentiallyRelevantNamespaces
in interfaceValueParser<T>
- Returns:
- May return null if not supported or no namespace declarations are present.
-
freeze
public ValueParser<T> freeze()
- Specified by:
freeze
in interfaceValueParser<T>
- Returns:
- Frozen version of this parser.
-
asDomElement
public Element asDomElement() throws IOException
- Throws:
IOException
-
-