Class DatamodelConverter
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.DatamodelConverter
- All Implemented Interfaces:
SnakVisitor<Snak>
,ValueVisitor<Value>
Class to re-create data model objects using a specified factory. This is
provided in place of having copy constructors in each and every
implementation of the data model. Note that data model objects are usually
immutable and do not need to be copied. The use of this class is to convert
data objects to a specific implementation, as might be needed for some
specialized purpose (e.g., for JSON export).
- Author:
- Markus Kroetzsch
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCopies aClaim
.copy
(DatatypeIdValue object) Copies aDatatypeIdValue
.copy
(FormDocument object) Copies aFormDocument
.copy
(FormIdValue object) Copies aFormIdValue
.copy
(GlobeCoordinatesValue object) Copies aGlobeCoordinatesValue
.copy
(ItemDocument object) Copies anItemDocument
.copy
(ItemIdValue object) Copies anItemIdValue
.copy
(LexemeDocument object) Copies aLexemeDocument
.copy
(LexemeIdValue object) Copies aLexemeIdValue
.copy
(MediaInfoDocument object) Copies aMediaInfoDocument
.copy
(MediaInfoIdValue object) Copies aMediaInfoIdValue
.copy
(MonolingualTextValue object) Copies aMonolingualTextValue
copy
(NoValueSnak object) Copies aNoValueSnak
.copy
(PropertyDocument object) Copies aPropertyDocument
.copy
(PropertyIdValue object) Copies aPropertyIdValue
.copy
(QuantityValue object) Copies aQuantityValue
.Copies aReference
.copy
(SenseDocument object) Copies aSenseDocument
.copy
(SenseIdValue object) Copies aSenseIdValue
.Copies aSiteLink
.Copies aSnakGroup
.copy
(SomeValueSnak object) Copies aSomeValueSnak
.Copies aStatement
.copy
(StatementGroup object) Copies aStatementGroup
.copy
(StringValue object) Copies aStringValue
.Copies aTimeValue
.copy
(UnsupportedValue object) Copies anUnsupportedValue
.Copies aValueSnak
.Copies aSnak
.Copies aValue
.visit
(EntityIdValue value) Visits a EntityIdValue and returns a result.visit
(GlobeCoordinatesValue value) Visits a GlobeCoordinatesValue and returns a result.visit
(MonolingualTextValue value) Visits a MonolingualTextValue and returns a result.visit
(NoValueSnak snak) Visits a NoValueSnak and returns a result.visit
(QuantityValue value) Visits a QuantityValue and returns a result.visit
(SomeValueSnak snak) Visits a SomeValueSnak and returns a result.visit
(StringValue value) Visits a StringValue and returns a result.Visits a TimeValue and returns a result.visit
(UnsupportedValue value) Visits an UnsupportedValue and returns a resultVisits a ValueSnak and returns a result.
-
Constructor Details
-
DatamodelConverter
Constructor.- Parameters:
dataObjectFactory
- the factory to use for creating new objects
-
-
Method Details
-
copy
Copies anItemIdValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aPropertyIdValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aLexemeIdValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aFormIdValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aSenseIdValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aMediaInfoIdValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aDatatypeIdValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aTimeValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aGlobeCoordinatesValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aStringValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aMonolingualTextValue
- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aQuantityValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies anUnsupportedValue
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aValueSnak
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aSomeValueSnak
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aNoValueSnak
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aSnakGroup
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aClaim
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aReference
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aStatement
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aStatementGroup
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aSiteLink
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aPropertyDocument
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies anItemDocument
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aMediaInfoDocument
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aLexemeDocument
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aFormDocument
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copy
Copies aSenseDocument
.- Parameters:
object
- object to copy- Returns:
- copied object
-
copySnak
Copies aSnak
.- Parameters:
snak
- object to copy- Returns:
- copied object
-
visit
Description copied from interface:SnakVisitor
Visits a ValueSnak and returns a result.- Specified by:
visit
in interfaceSnakVisitor<Snak>
- Parameters:
snak
- the snak to visit- Returns:
- the result for this snak
-
visit
Description copied from interface:SnakVisitor
Visits a SomeValueSnak and returns a result.- Specified by:
visit
in interfaceSnakVisitor<Snak>
- Parameters:
snak
- the snak to visit- Returns:
- the result for this snak
-
visit
Description copied from interface:SnakVisitor
Visits a NoValueSnak and returns a result.- Specified by:
visit
in interfaceSnakVisitor<Snak>
- Parameters:
snak
- the snak to visit- Returns:
- the result for this snak
-
copyValue
Copies aValue
.- Parameters:
value
- object to copy- Returns:
- copied object
-
visit
Description copied from interface:ValueVisitor
Visits a EntityIdValue and returns a result. In practice, only specific subtypes of EntityIdValue are used, such asItemIdValue
andPropertyIdValue
. Since the set of possible subtypes can be extended by extensions of Wikibase, the visitor only visits the general (abstract) supertype. Implementations will have to decide if the given specific type is supported and what to do with it.- Specified by:
visit
in interfaceValueVisitor<Value>
- Parameters:
value
- the value to visit- Returns:
- the result for this value
-
visit
Description copied from interface:ValueVisitor
Visits a GlobeCoordinatesValue and returns a result.- Specified by:
visit
in interfaceValueVisitor<Value>
- Parameters:
value
- the value to visit- Returns:
- the result for this value
-
visit
Description copied from interface:ValueVisitor
Visits a MonolingualTextValue and returns a result.- Specified by:
visit
in interfaceValueVisitor<Value>
- Parameters:
value
- the value to visit- Returns:
- the result for this value
-
visit
Description copied from interface:ValueVisitor
Visits a QuantityValue and returns a result.- Specified by:
visit
in interfaceValueVisitor<Value>
- Parameters:
value
- the value to visit- Returns:
- the result for this value
-
visit
Description copied from interface:ValueVisitor
Visits a StringValue and returns a result.- Specified by:
visit
in interfaceValueVisitor<Value>
- Parameters:
value
- the value to visit- Returns:
- the result for this value
-
visit
Description copied from interface:ValueVisitor
Visits a TimeValue and returns a result.- Specified by:
visit
in interfaceValueVisitor<Value>
- Parameters:
value
- the value to visit- Returns:
- the result for this value
-
visit
Description copied from interface:ValueVisitor
Visits an UnsupportedValue and returns a result- Specified by:
visit
in interfaceValueVisitor<Value>
- Parameters:
value
- the value to visit- Returns:
- the result for this value
-