public class DBObjectBuilderImpl extends java.lang.Object implements DBObjectBuilder
| Constructor and Description |
|---|
DBObjectBuilderImpl(ConverterService converterService,
XMLResource.URIHandler uriHandler,
CodecRegistry codecRegistry,
java.util.Map<?,?> options) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildAttribute(BsonWriter writer,
EObject eObject,
EAttribute attribute,
EncoderContext context)
Serializes the attribute from the EMF object into the DBObject
Feature maps are delegated to buildFeatureMap() and non-native arrays to
buildAttributeArray().
|
protected void |
buildAttributeArray(BsonWriter writer,
EAttribute attribute,
java.lang.Object values)
Serializes an attribute as a java.util.ArrayList.
|
protected void |
buildAttributeValue(BsonWriter writer,
EAttribute attribute,
java.lang.Object value)
Converts the attribute value if needed
|
void |
buildDBObject(BsonWriter writer,
EObject eObject,
EncoderContext context)
Build a Mongo DB object from the supplied EMF object using streamings.
|
protected void |
buildExtrinsicID(BsonWriter writer,
EObject eObject)
Sets the extrensic ID if it exists and the resource is of type XMLResource.
|
protected void |
buildFeatureMap(BsonWriter writer,
EAttribute attribute,
java.lang.Object value,
EncoderContext context)
Serializes a feature map from the attribute value.
|
protected void |
buildReference(BsonWriter writer,
EObject eObject,
EReference reference,
EncoderContext context)
Serializes a reference value from the EMF object.
|
void |
buildReferencedObject(BsonWriter writer,
EReference eReference,
EObject targetObject,
EncoderContext context)
Serializes a reference as an embedded object or a proxy as appropriate
|
java.lang.Object |
convertEMFToMongoValue(EDataType eDataType,
java.lang.Object emfValue)
Converts the EMF value into a MongoDB value using the converter service
|
void |
writePrimitiveValue(java.lang.String name,
java.lang.Object value,
BsonWriter writer)
Writes a primitive value to the
BsonWriter. |
void |
writePrimitiveValueNoName(java.lang.Object value,
BsonWriter writer)
Writes a primitive value to the
BsonWriter. |
public DBObjectBuilderImpl(ConverterService converterService,
XMLResource.URIHandler uriHandler,
CodecRegistry codecRegistry,
java.util.Map<?,?> options)
converterService - the service to use when converting attribute valuesuriHandler - the handler for creating proxy URIsserializeDefaultAttributeValues - true causes default attribute values to be written to the DBObject;
false causes default attribute values to be skippedresourceSet - options - the resource save optionspublic void buildDBObject(BsonWriter writer,
EObject eObject,
EncoderContext context)
DBObjectBuilderbuildDBObject in interface DBObjectBuilderwriter - the BsonWriter instance to write intoeObject - the EMF object to serializeprotected void buildAttribute(BsonWriter writer,
EObject eObject,
EAttribute attribute,
EncoderContext context)
writer - the BsonWriter to write intoeObject - the EMF object to serializeattribute - the attribute to serialize from the EMF objectcontext - the encoder contextprotected void buildAttributeArray(BsonWriter writer,
EAttribute attribute,
java.lang.Object values)
writer - the BsonWriter to write intoattribute - the attribute to serialize from the EMF objectvalues - the attribute values to serializeprotected void buildAttributeValue(BsonWriter writer,
EAttribute attribute,
java.lang.Object value)
writer - the BsonWriter to write intoattribute - the attribute to serialize from the EMF objectvalue - the value of the attribute from the EMF objectprotected void buildExtrinsicID(BsonWriter writer,
EObject eObject)
writer - the BsonWriter to write intoeObject - the EMF object to serializeprotected void buildFeatureMap(BsonWriter writer,
EAttribute attribute,
java.lang.Object value,
EncoderContext context)
writer - the BsonWriter to write intoattribute - the emf attribute being serializedvalue - the feature mapprotected void buildReference(BsonWriter writer,
EObject eObject,
EReference reference,
EncoderContext context)
writer - the BsonWriter to write intoeObject - the EMF object to serializereference - public void buildReferencedObject(BsonWriter writer,
EReference eReference,
EObject targetObject,
EncoderContext context)
DBObjectBuilderbuildReferencedObject in interface DBObjectBuilderwriter - the BsonWriter to write intoeReference - the reference to serializetargetObject - to referenced objectcontext - the encoder contextpublic java.lang.Object convertEMFToMongoValue(EDataType eDataType,
java.lang.Object emfValue)
convertEMFToMongoValue in interface DBObjectBuildereDataType - the value typeemfValue - the valuepublic void writePrimitiveValueNoName(java.lang.Object value,
BsonWriter writer)
BsonWriter. If the value is null, nothing will be writtenwritePrimitiveValueNoName in interface DBObjectBuildervalue - the valuewriter - the writer to write intopublic void writePrimitiveValue(java.lang.String name,
java.lang.Object value,
BsonWriter writer)
BsonWriter. If the value is null, nothing will be writtenwritePrimitiveValue in interface DBObjectBuildername - the name of the fieldvalue - the valuewriter - the writer to write intoBryan Hunt, Data In Motion Consulting