public class JsonInjector
extends java.lang.Object
In the context of the JSON discoverer, the JsonInjector
is used to represent the
data model of a JSON-based Web service during the Simple discovery process.
This implementation does not depend on Xtext
Modifier and Type | Field and Description |
---|---|
private SingleJsonSource |
jsonSource
The source to inject.
|
private static java.util.logging.Logger |
LOGGER
Used to log all the activity
|
Constructor and Description |
---|
JsonInjector(SingleJsonSource jsonSource)
Constructs a new
JsonInjector with a SingleJsonSource . |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
digestId(java.lang.String id)
Digest a String
|
protected java.lang.Object |
digestValue(org.eclipse.emf.ecore.EAttribute eAttribute,
com.google.gson.JsonElement value)
Analyzes the type of the attribute to convert the JSON value
|
org.eclipse.emf.ecore.EPackage |
getEPackage()
Returns the metamodel of the
JsonSource |
java.util.List<org.eclipse.emf.ecore.EObject> |
inject()
Injects a model from a
SingleJsonSource |
private java.util.List<org.eclipse.emf.ecore.EObject> |
inject(java.util.List<com.google.gson.JsonObject> elements)
Injects a model conforming to the metamodel from a set of Json Objects
|
protected org.eclipse.emf.ecore.EObject |
instantiateEClassifier(org.eclipse.emf.ecore.EClassifier eClassifier,
com.google.gson.JsonObject jsonObject)
Instantiates an
EClassifier from a JsonObject |
protected void |
setStructuralFeature(org.eclipse.emf.ecore.EObject result,
org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
com.google.gson.JsonElement value)
Setting a structural features
|
private static final java.util.logging.Logger LOGGER
private SingleJsonSource jsonSource
Note that it must be a SingleJsonSource
public JsonInjector(SingleJsonSource jsonSource)
JsonInjector
with a SingleJsonSource
.
Note that the input parameter is a SingleJsonSource
.
jsonSource
- The SingleJsonSource
used to injectpublic java.util.List<org.eclipse.emf.ecore.EObject> inject()
SingleJsonSource
EObject
sprivate java.util.List<org.eclipse.emf.ecore.EObject> inject(java.util.List<com.google.gson.JsonObject> elements)
elements
- List of JSON objects (as list of JsonObject
)EObject
sprotected org.eclipse.emf.ecore.EObject instantiateEClassifier(org.eclipse.emf.ecore.EClassifier eClassifier, com.google.gson.JsonObject jsonObject)
EClassifier
from a JsonObject
eClassifier
- Classifier to instantiatejsonObject
- JSON Object from which we takes the dataprotected void setStructuralFeature(org.eclipse.emf.ecore.EObject result, org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, com.google.gson.JsonElement value)
result
- Object containing the structural feature to seteStructuralFeature
- Structural feature to setvalue
- Value to setprotected java.lang.Object digestValue(org.eclipse.emf.ecore.EAttribute eAttribute, com.google.gson.JsonElement value)
eAttribute
- The EAttribute
value
- The value to convertJsonPrimitive
)private java.lang.String digestId(java.lang.String id)
id
- String to digestpublic org.eclipse.emf.ecore.EPackage getEPackage()
JsonSource
EPackage
)