Class ValueSnakImpl
java.lang.Object
org.wikidata.wdtk.datamodel.implementation.SnakImpl
org.wikidata.wdtk.datamodel.implementation.ValueSnakImpl
Jackson implementation of
ValueSnak
.- Author:
- Fredo Erxleben, Antonin Delpeuch
-
Field Summary
Fields inherited from class org.wikidata.wdtk.datamodel.implementation.SnakImpl
JSON_SNAK_TYPE_NOVALUE, JSON_SNAK_TYPE_SOMEVALUE, JSON_SNAK_TYPE_VALUE
-
Constructor Summary
ModifierConstructorDescriptionprotected
ValueSnakImpl
(String property, String datatype, Value datavalue, String siteIri) Constructor used to deserialize from JSON with Jackson.ValueSnakImpl
(PropertyIdValue property, Value value) Constructor. -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(SnakVisitor<T> snakVisitor) Accept a SnakVisitor and return its output.boolean
Returns the JSON datatype string.protected static String
Infer the JSON datatype (represented as a string) from the data value.getValue()
Get theValue
of this Snakint
hashCode()
toString()
Methods inherited from class org.wikidata.wdtk.datamodel.implementation.SnakImpl
getProperty, getPropertyId
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.wikidata.wdtk.datamodel.interfaces.Snak
getPropertyId
-
Constructor Details
-
ValueSnakImpl
Constructor.- Parameters:
property
- the id of the property used in this snakvalue
- the target value for this snak
-
ValueSnakImpl
Constructor used to deserialize from JSON with Jackson.
-
-
Method Details
-
getDatavalue
-
getValue
Description copied from interface:ValueSnak
Get theValue
of this Snak -
getDatatype
Returns the JSON datatype string. Only for use by Jackson during serialization. The property datatype of the property used for this value snak. This is redundant information provided in the JSON but not represented in the datamodel. We keep it and serialize it if given, but if we do not have it, we set it to null and it will be omitted in the serialization.- Returns:
- the JSON datatype string
-
getSnakType
- Specified by:
getSnakType
in classSnakImpl
-
accept
Description copied from interface:Snak
Accept a SnakVisitor and return its output. -
hashCode
public int hashCode() -
equals
-
toString
-
getJsonPropertyTypeForValueType
Infer the JSON datatype (represented as a string) from the data value.- Parameters:
value
- the datavalue used as snak value- Returns:
- the JSON type (possibly null) to include in the serialization of the snak
-