Class PrimitiveXNodeImpl<T>
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.xnode.XNodeImpl
-
- com.evolveum.midpoint.prism.impl.xnode.PrimitiveXNodeImpl<T>
-
- All Implemented Interfaces:
Copyable<XNode>
,Freezable
,Visitable<XNode>
,MetadataAware
,PrimitiveXNode<T>
,XNode
,DebugDumpable
,Serializable
,Cloneable
public class PrimitiveXNodeImpl<T> extends XNodeImpl implements Serializable, PrimitiveXNode<T>
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.evolveum.midpoint.prism.impl.xnode.XNodeImpl
elementName, KEY_CONTAINER_ID, KEY_OID, KEY_REFERENCE_DESCRIPTION, KEY_REFERENCE_FILTER, KEY_REFERENCE_OBJECT, KEY_REFERENCE_OID, KEY_REFERENCE_REFERENTIAL_INTEGRITY, KEY_REFERENCE_RELATION, KEY_REFERENCE_RESOLUTION_TIME, KEY_REFERENCE_TARGET_NAME, KEY_REFERENCE_TYPE, KEY_VERSION, maxOccurs, parent, typeQName
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description PrimitiveXNodeImpl()
PrimitiveXNodeImpl(PrismNamespaceContext ctx)
PrimitiveXNodeImpl(T value)
PrimitiveXNodeImpl(T value, PrismNamespaceContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor<XNode> visitor)
PrimitiveXNode<T>
copy()
String
debugDump(int indent)
boolean
equals(Object obj)
String
getDesc()
String
getFormattedValue()
Returns a value that is correctly string-formatted according to its type definition.String
getGuessedFormattedValue()
Returns formatted parsed value without actually changing node state from UNPARSED to PARSED (if node is originally unparsed).@NotNull List<MapXNode>
getMetadataNodes()
<X> X
getParsedValue(@NotNull QName typeName, @Nullable Class<X> expectedClass)
<X> X
getParsedValue(@NotNull QName typeName, @Nullable Class<X> expectedClass, XNodeProcessorEvaluationMode mode)
T
getParsedValueWithoutRecording(QName typeName)
Returns parsed value without actually changing node state from UNPARSED to PARSED (if node is originally unparsed).Map<String,String>
getRelevantNamespaceDeclarations()
This method is used with conjunction with getStringValue, typically when serializing unparsed values.String
getStringValue()
Returns the value represented as string - in the best format that we can.T
getValue()
ValueParser<T>
getValueParser()
int
hashCode()
The basic idea of equals() is: - if parsed, compare the value; - if unparsed, compare getStringValue() Therefore the hashcode is generated based on value (if parsed) or getStringValue() (if unparsed).boolean
isAttribute()
boolean
isEmpty()
boolean
isInfra()
boolean
isParsed()
void
performFreeze()
void
setAttribute(boolean isAttribute)
void
setInfra(boolean value)
void
setMetadataNodes(@NotNull List<MapXNode> metadataNodes)
void
setValue(T value, QName typeQName)
void
setValue(T value, QName typeQName, SerializationOptions options)
void
setValueParser(ValueParser<T> valueParser)
String
toString()
-
Methods inherited from class com.evolveum.midpoint.prism.impl.xnode.XNodeImpl
clone, cloneTransformKeys, copyCommonAttributesFrom, copyCommonTo, dumpSuffix, getComment, getElementName, getLineNumber, getMaxOccurs, getOriginDescription, getOriginFile, getParent, getParserData, getTypeQName, isExplicitTypeDeclaration, isHeterogeneousList, isSingleEntryMap, namespaceContext, setComment, setElementName, setExplicitTypeDeclaration, setLineNumber, setMaxOccurs, setOriginDescription, setOriginFile, setParent, setParserData, setTypeQName, toRootXNode
-
Methods inherited from class com.evolveum.midpoint.prism.AbstractFreezable
freeze, freeze, freezeAll, freezeNullableList, isImmutable, isMutable
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze, isImmutable
-
Methods inherited from interface com.evolveum.midpoint.prism.xnode.MetadataAware
addMetadataNode
-
Methods inherited from interface com.evolveum.midpoint.prism.xnode.XNode
clone, frozen, getMaxOccurs, getTypeQName, hasMetadata, isExplicitTypeDeclaration, namespaceContext, toRootXNode
-
-
-
-
Constructor Detail
-
PrimitiveXNodeImpl
public PrimitiveXNodeImpl()
-
PrimitiveXNodeImpl
public PrimitiveXNodeImpl(T value)
-
PrimitiveXNodeImpl
public PrimitiveXNodeImpl(PrismNamespaceContext ctx)
-
PrimitiveXNodeImpl
public PrimitiveXNodeImpl(T value, PrismNamespaceContext ctx)
-
-
Method Detail
-
getValue
public T getValue()
- Specified by:
getValue
in interfacePrimitiveXNode<T>
-
getParsedValue
public <X> X getParsedValue(@NotNull @NotNull QName typeName, @Nullable @Nullable Class<X> expectedClass) throws SchemaException
- Specified by:
getParsedValue
in interfacePrimitiveXNode<T>
- Throws:
SchemaException
-
getParsedValue
public <X> X getParsedValue(@NotNull @NotNull QName typeName, @Nullable @Nullable Class<X> expectedClass, XNodeProcessorEvaluationMode mode) throws SchemaException
- Throws:
SchemaException
-
getValueParser
public ValueParser<T> getValueParser()
- Specified by:
getValueParser
in interfacePrimitiveXNode<T>
-
setValueParser
public void setValueParser(ValueParser<T> valueParser)
-
setValue
public void setValue(T value, QName typeQName, SerializationOptions options)
-
isParsed
public boolean isParsed()
- Specified by:
isParsed
in interfacePrimitiveXNode<T>
-
isAttribute
public boolean isAttribute()
-
setAttribute
public void setAttribute(boolean isAttribute)
-
isEmpty
public boolean isEmpty()
-
getParsedValueWithoutRecording
public T getParsedValueWithoutRecording(QName typeName) throws SchemaException
Returns parsed value without actually changing node state from UNPARSED to PARSED (if node is originally unparsed). Useful when we are not sure about the type name and do not want to record parsed value based on wrong type name.- Throws:
SchemaException
-
getFormattedValue
public String getFormattedValue()
Returns a value that is correctly string-formatted according to its type definition. Works properly only if definition is set.
-
getGuessedFormattedValue
public String getGuessedFormattedValue() throws SchemaException
Returns formatted parsed value without actually changing node state from UNPARSED to PARSED (if node is originally unparsed). Useful e.g. to serialize nodes that have a type declaration but were not parsed yet. Experimental. Should be thought through yet.- Specified by:
getGuessedFormattedValue
in interfacePrimitiveXNode<T>
- Returns:
- properly formatted value
- Throws:
SchemaException
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
getStringValue
public String getStringValue()
Description copied from interface:PrimitiveXNode
Returns the value represented as string - in the best format that we can. 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 this xnode, e.g. it will NOT cause it to be parsed.- Specified by:
getStringValue
in interfacePrimitiveXNode<T>
-
getRelevantNamespaceDeclarations
public Map<String,String> getRelevantNamespaceDeclarations()
This method is used with conjunction with getStringValue, typically when serializing unparsed values. Because the string value can represent QName or ItemPath, we have to provide relevant namespace declarations. Because we cannot know for sure, we are allowed to return namespace declarations that are not actually used. We should minimize number of such declarations, however. Current implementation simply grabs all potential namespace declarations and searches the xnode's string value for any 'prefix:' substrings. I'm afraid it is all we can do for now. THIS METHOD SHOULD BE CALLED ONLY ON EITHER UNPARSED OR EMPTY NODES.
-
hashCode
public int hashCode()
The basic idea of equals() is: - if parsed, compare the value; - if unparsed, compare getStringValue() Therefore the hashcode is generated based on value (if parsed) or getStringValue() (if unparsed).
-
performFreeze
public void performFreeze()
- Overrides:
performFreeze
in classAbstractFreezable
-
copy
public PrimitiveXNode<T> copy()
-
getMetadataNodes
@NotNull public @NotNull List<MapXNode> getMetadataNodes()
- Specified by:
getMetadataNodes
in interfaceMetadataAware
-
setMetadataNodes
public void setMetadataNodes(@NotNull @NotNull List<MapXNode> metadataNodes)
- Specified by:
setMetadataNodes
in interfaceMetadataAware
-
setInfra
public void setInfra(boolean value)
-
isInfra
public boolean isInfra()
-
-