private static Object parseValueForDataType(JsonParser jp, EDataType dataType) throws JsonParseException, IOException { if (dataType.getEPackage() == EcorePackage.eINSTANCE) { switch (dataType.getClassifierID()) { case EcorePackage.EBOOLEAN: return jp.getBooleanValue(); case EcorePackage.EBYTE: return jp.getByteValue(); case EcorePackage.ESHORT: return jp.getShortValue(); case EcorePackage.EINT: return jp.getIntValue(); case EcorePackage.ELONG: return jp.getLongValue(); case EcorePackage.EFLOAT: return jp.getFloatValue(); case EcorePackage.EDOUBLE: return jp.getDoubleValue(); case EcorePackage.ESTRING: return jp.getText(); } } return dataType.getEPackage().getEFactoryInstance().createFromString(dataType, jp.getText()); }
jg.writeFieldName(fieldName); if (dataType.getEPackage() == EcorePackage.eINSTANCE) { switch (dataType.getClassifierID()) { case EcorePackage.EBOOLEAN: dataType.getEPackage().getEFactoryInstance().convertToString(dataType, value));
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ private static Object coerce(final Object value, final EDataType type) { return type.getEPackage().getEFactoryInstance().createFromString(type, value.toString()); }
public SimpleContentFeatureMapEntry(EStructuralFeature.Internal eStructuralFeature) { super(eStructuralFeature); eDataType = (EDataType)eStructuralFeature.getEType(); eFactory = eDataType.getEPackage().getEFactoryInstance(); }
/** * Creates an instance of the datatype. * @param eDataType the datatype to instantiate. * @param literal the string value of the datatype. * @return an instance of the datatype. * @see #convertToString(EDataType, Object) */ public static Object createFromString(EDataType eDataType, String literal) { return eDataType.getEPackage().getEFactoryInstance().createFromString(eDataType, literal); }
/** * Converts an instance of the data type to a string literal representation. * @param eDataType the data type to instantiate. * @param value a value of the data type. * @return the string literal representation of the value. * @see #createFromString(EDataType, String) */ public static String convertToString(EDataType eDataType, Object value) { return eDataType.getEPackage().getEFactoryInstance().convertToString(eDataType, value); }
public SimpleContentFeatureMapEntry(EStructuralFeature.Internal eStructuralFeature) { super(eStructuralFeature); eDataType = (EDataType)eStructuralFeature.getEType(); eFactory = eDataType.getEPackage().getEFactoryInstance(); }
public static Object createFromString(EDataType type, String value) { try { return type.getEPackage().getEFactoryInstance().createFromString((EDataType)type, value); } catch (NumberFormatException e) { return value; } catch (IllegalArgumentException e) { return value; } }
/** * Converts an instance of the data type to a string literal representation. * @param eDataType the data type to instantiate. * @param value a value of the data type. * @return the string literal representation of the value. * @see #createFromString(EDataType, String) */ public static String convertToString(EDataType eDataType, Object value) { return eDataType.getEPackage().getEFactoryInstance().convertToString(eDataType, value); }
/** * Creates an instance of the datatype. * @param eDataType the datatype to instantiate. * @param literal the string value of the datatype. * @return an instance of the datatype. * @see #convertToString(EDataType, Object) */ public static Object createFromString(EDataType eDataType, String literal) { return eDataType.getEPackage().getEFactoryInstance().createFromString(eDataType, literal); }
@Override protected String toEscapedString(Object value) { return dataType.getEPackage().getEFactoryInstance().convertToString(dataType, value); }
public String toString(Object value) { return dataType.getEPackage().getEFactoryInstance().convertToString(dataType, value); }
public Object toValue(String string, INode node) throws ValueConverterException { try { return dataType.getEPackage().getEFactoryInstance().createFromString(dataType, string); } catch (Exception exc) { throw new ValueConverterException("Error converting string to value", node, exc); } }
/** * @since 2.8 */ public static EDataType.Internal.ConversionDelegate.Factory getConversionDelegateFactory(EDataType eDataType) { for (String eDataTypeDelegate : getConversionDelegates(eDataType.getEPackage())) { if (eDataType.getEAnnotation(eDataTypeDelegate) != null) { return EDataType.Internal.ConversionDelegate.Factory.Registry.INSTANCE.getFactory(eDataTypeDelegate); } } return null; }
/** * @since 2.8 */ public static EDataType.Internal.ConversionDelegate.Factory getConversionDelegateFactory(EDataType eDataType) { for (String eDataTypeDelegate : getConversionDelegates(eDataType.getEPackage())) { if (eDataType.getEAnnotation(eDataTypeDelegate) != null) { return EDataType.Internal.ConversionDelegate.Factory.Registry.INSTANCE.getFactory(eDataTypeDelegate); } } return null; }
protected EDataType basicGetItemType(EDataType eDataType) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { EMap<String, String> details = eAnnotation.getDetails(); String itemType = details.get("itemType"); EClassifier type = getEClassifier(eDataType.getEPackage(), itemType); if (type instanceof EDataType) { return (EDataType)type; } } return null; }
public Object toValue(String string, INode node) throws ValueConverterException { try { Object value = dataType.getEPackage().getEFactoryInstance().createFromString(dataType, string); if (value == null && dataType.getInstanceClass().isPrimitive()) { throw new ValueConverterException("Couldn't convert '" + Strings.notNull(string) + "' to " + dataType.getName() + ".", node, null); } return value; } catch (Exception exc) { throw new ValueConverterException("Error converting string to value", node, exc); } }
public String getQName(EDataType c) { String name = getName(c); if (xmlMap != null) { XMLResource.XMLInfo clsInfo = xmlMap.getInfo(c); if (clsInfo != null) { String targetNamespace = clsInfo.getTargetNamespace(); return getQName(targetNamespace, name); } } return getQName(c.getEPackage(), name); }
public String getQName(EDataType c) { String name = getName(c); if (xmlMap != null) { XMLResource.XMLInfo clsInfo = xmlMap.getInfo(c); if (clsInfo != null) { String targetNamespace = clsInfo.getTargetNamespace(); return getQName(targetNamespace, name); } } return getQName(c.getEPackage(), name); }
public GenDataType getObjectType() { ExtendedMetaData extendedMetaData = getExtendedMetaData(); EDataType eDataType = getEcoreDataType(); EClassifier eClassifier = extendedMetaData.getType(eDataType.getEPackage(), extendedMetaData.getName(eDataType) + ":Object"); if (eClassifier instanceof EDataType) { GenDataType result = findGenDataType((EDataType)eClassifier); if (result != null) { return result; } } return this; }