@Override public Object convertToEMF(EClassifier eType, Object value) { return EcoreUtil.createFromString((EDataType)eType, (String)value); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public Object getValue() { return EcoreUtil.createFromString(instanceType, getRawValue()); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public Object getValue() { return EcoreUtil.createFromString(instanceType, getRawValue()); }
/** * Creates an instance of the {@code attribute}. * * @param attribute the attribute to instantiate * @param property the string value of the attribute * * @return an instance of the attribute * * @see EcoreUtil#createFromString(EDataType, String) */ protected Object parseProperty(EAttribute attribute, Object property) { return isNull(property) ? null : EcoreUtil.createFromString(attribute.getEAttributeType(), property.toString()); }
@Override protected Object resolve(int index, Object object) { EDataType type = (EDataType)getFeature().getEType(); return EcoreUtil.createFromString(type, (String)object); }
@Override protected Object resolve(int index, Object object) { EDataType type = (EDataType)getFeature().getEType(); return EcoreUtil.createFromString(type, (String)object); }
@Override public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { final EDataType dataType = EMFContext.getDataType(ctxt); if (dataType == null) { return null; } else { Class<?> type = dataType.getInstanceClass(); if (type == null || dataType instanceof EEnum || EJAVA_CLASS.equals(dataType) || EJAVA_OBJECT.equals(dataType)) { return EcoreUtil.createFromString(dataType, jp.getText()); } else { return ctxt.readValue(jp, type); } } }
@Override public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { final EDataType dataType = EMFContext.getDataType(ctxt); if (dataType == null) { return null; } else { Class<?> type = dataType.getInstanceClass(); if (type == null || dataType instanceof EEnum || EJAVA_CLASS.equals(dataType) || EJAVA_OBJECT.equals(dataType)) { return EcoreUtil.createFromString(dataType, jp.getText()); } else { return ctxt.readValue(jp, type); } } }
@Override public IWrapperItemProvider copy() { Object valueCopy = null; if (value != null) { EDataType dataType = ((EAttribute)feature).getEAttributeType(); String serialization = EcoreUtil.convertToString(dataType, value); valueCopy = EcoreUtil.createFromString(dataType, serialization); if (serialization == value && serialization == valueCopy) { valueCopy = new String((String)value); } } return new AttributeValueWrapperItemProvider( valueCopy, (EObject)AttributeValueWrapperItemProvider.this.owner, (EAttribute)feature, index, adapterFactory); } };
/** * {@inheritDoc} * <p> * Converts an instance of the {@code attribute} to a string literal representation. * * @param value the value of the attribute * @param attribute the attribute to instantiate * * @return the string literal representation of the value, or {@code null} if the {@code value} is {@code null} * * @see #revert(Object, EAttribute) * @see EcoreUtil#convertToString(EDataType, Object) */ @Override public Object convert(@Nullable String value, EAttribute attribute) { if (isNull(value)) { return null; } final EDataType dataType = attribute.getEAttributeType(); if (!(dataType instanceof EEnum) && Primitives.isPrimitiveOrString(dataType.getInstanceClass())) { return EcoreUtil.createFromString(dataType, value); } if (FeatureMapUtil.isFeatureMapEntry(dataType)) { throw new UnsupportedOperationException("FeatureMaps are not supported yet: Use standard EMF to import your model"); } return value; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public Object getValue() { EStructuralFeature feature = getFeature(); if (feature instanceof EReference) { return getReferenceValue(); } else if (value == null) // feature is instance of EAttribute { EDataType type = (EDataType)feature.getEType(); value = EcoreUtil.createFromString(type, valueString); } return value; }
/** * Sets the value of the object's ID attribute according to the value represented by the String. * A <code>null</code> ID will unset the attribute rather than setting it to <code>null</code>. * @param eObject the object in question. * @param id the String value of the new ID. * @throws IllegalArgumentException if the object has no ID attribute. * @see #getID(EObject) * @see org.eclipse.emf.ecore.EAttribute#isID * @see org.eclipse.emf.ecore.EClass#getEIDAttribute */ public static void setID(EObject eObject, String id) { EClass eClass = eObject.eClass(); EAttribute eIDAttribute = eClass.getEIDAttribute(); if (eIDAttribute == null) { throw new IllegalArgumentException("The object doesn't have an ID feature."); } else if (id == null) { eObject.eUnset(eIDAttribute); } else { eObject.eSet(eIDAttribute, createFromString(eIDAttribute.getEAttributeType(), id)); } }
/** * Sets the value of the object's ID attribute according to the value represented by the String. * A <code>null</code> ID will unset the attribute rather than setting it to <code>null</code>. * @param eObject the object in question. * @param id the String value of the new ID. * @throws IllegalArgumentException if the object has no ID attribute. * @see #getID(EObject) * @see org.eclipse.emf.ecore.EAttribute#isID * @see org.eclipse.emf.ecore.EClass#getEIDAttribute */ public static void setID(EObject eObject, String id) { EClass eClass = eObject.eClass(); EAttribute eIDAttribute = eClass.getEIDAttribute(); if (eIDAttribute == null) { throw new IllegalArgumentException("The object doesn't have an ID feature."); } else if (id == null) { eObject.eUnset(eIDAttribute); } else { eObject.eSet(eIDAttribute, createFromString(eIDAttribute.getEAttributeType(), id)); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public Object getValue() { EStructuralFeature feature = getFeature(); if (feature instanceof EReference) { return getReferenceValue(); } else if (value == null) // feature is instance of EAttribute { EDataType type = (EDataType)feature.getEType(); value = EcoreUtil.createFromString(type, valueString); } return value; }
try Object value = EcoreUtil.createFromString(dataType, literalValue); dataValues.add(value); EValidator rootEValidator = getRootEValidator(context);
return EcoreUtil.createFromString(dataType, strValue);
@Override public IWrapperItemProvider copy() { Object entryValueCopy = null; Object entryValue = getEntryValue(); if (entryValue != null) { EDataType dataType = (EDataType)getEntryFeature().getEType(); String serialization = EcoreUtil.convertToString(dataType, entryValue); entryValueCopy = EcoreUtil.createFromString(dataType, serialization); if (serialization == entryValue && serialization == entryValueCopy) { entryValueCopy = new String((String)entryValue); } } return new FeatureMapEntryWrapperItemProvider( FeatureMapUtil.createEntry(getEntryFeature(), entryValueCopy), (EObject)FeatureMapEntryWrapperItemProvider.this.owner, (EAttribute)feature, index, adapterFactory); } };
value = EcoreUtil.createFromString(entryAttribute.getEAttributeType(), splitValues[1]);
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public Object getValue() { EStructuralFeature feature = getFeature(); if (feature.getUpperBound() != 1) { if (value == null && eContainer() instanceof EObjectToChangesMapEntryImpl) { value = getListValue((EList<?>)((EObjectToChangesMapEntryImpl)eContainer()).getTypedKey().eGet(feature)); } } else if (feature instanceof EReference) { return getReferenceValue(); } else if (value == null) // feature is instance of EAttribute { EDataType type = (EDataType)feature.getEType(); value = EcoreUtil.createFromString(type, valueString); } return value; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public Object getValue() { EStructuralFeature feature = getFeature(); if (feature.getUpperBound() != 1) { if (value == null && eContainer() instanceof EObjectToChangesMapEntryImpl) { value = getListValue((EList<?>)((EObjectToChangesMapEntryImpl)eContainer()).getTypedKey().eGet(feature)); } } else if (feature instanceof EReference) { return getReferenceValue(); } else if (value == null) // feature is instance of EAttribute { EDataType type = (EDataType)feature.getEType(); value = EcoreUtil.createFromString(type, valueString); } return value; }