Class DefaultEAttributeValueConverterImpl
- java.lang.Object
-
- org.eclipse.emfforms.internal.common.converter.DefaultEAttributeValueConverterImpl
-
- All Implemented Interfaces:
EStructuralFeatureValueConverter
public class DefaultEAttributeValueConverterImpl extends java.lang.Object implements EStructuralFeatureValueConverter
Default value converter for generic EAttribute handling. Does currently not handle EReferences.- Author:
- Mathias Schaefer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.emfforms.spi.common.converter.EStructuralFeatureValueConverter
EStructuralFeatureValueConverter.Direction
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_LIST_SEPARATORDefault list separator token.static doubleDEFAULT_PRIORITYThe default priority for this converter implementation.-
Fields inherited from interface org.eclipse.emfforms.spi.common.converter.EStructuralFeatureValueConverter
NOT_APPLICABLE
-
-
Constructor Summary
Constructors Modifier Constructor Description DefaultEAttributeValueConverterImpl()Default no value constructor (will use the DEFAULT_LIST_SEPARATOR and DEFAULT_PRIORITY for this converter).protectedDefaultEAttributeValueConverterImpl(java.lang.String listSeparator, double priority)Constructor which allows to override the list separator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertToLiteral(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object instance)Convert model value instance to string literal.java.lang.ObjectconvertToModelValue(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String literal)Convert string literal to model value instance.protected java.lang.ObjectfromString(org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String literal)Convert literal to Object.doubleisApplicable(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value, EStructuralFeatureValueConverter.Direction direction)Check whether this converter instance is applicable for the given feature.protected java.lang.ObjecttoString(org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object instance)Basic conversion from model to string literal.
-
-
-
Field Detail
-
DEFAULT_LIST_SEPARATOR
public static final java.lang.String DEFAULT_LIST_SEPARATOR
Default list separator token.- See Also:
- Constant Field Values
-
DEFAULT_PRIORITY
public static final double DEFAULT_PRIORITY
The default priority for this converter implementation. Make sure your converter has a higher priority.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultEAttributeValueConverterImpl
public DefaultEAttributeValueConverterImpl()
Default no value constructor (will use the DEFAULT_LIST_SEPARATOR and DEFAULT_PRIORITY for this converter).
-
DefaultEAttributeValueConverterImpl
protected DefaultEAttributeValueConverterImpl(java.lang.String listSeparator, double priority)Constructor which allows to override the list separator.- Parameters:
listSeparator- the separator token to split lists (i.e. "|")priority- the priority for this converter
-
-
Method Detail
-
isApplicable
public double isApplicable(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value, EStructuralFeatureValueConverter.Direction direction)Description copied from interface:EStructuralFeatureValueConverterCheck whether this converter instance is applicable for the given feature.- Specified by:
isApplicablein interfaceEStructuralFeatureValueConverter- Parameters:
eObject- (optional)feature- the target featurevalue- the valuedirection- the direction- Returns:
- rank of converter (higher value means higher priority)
-
convertToModelValue
public java.lang.Object convertToModelValue(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String literal)Description copied from interface:EStructuralFeatureValueConverterConvert string literal to model value instance.- Specified by:
convertToModelValuein interfaceEStructuralFeatureValueConverter- Parameters:
eObject- (optional, only required for EReferences)feature- the target featureliteral- the string literal- Returns:
- converted value
-
convertToLiteral
public java.lang.Object convertToLiteral(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object instance)Description copied from interface:EStructuralFeatureValueConverterConvert model value instance to string literal.- Specified by:
convertToLiteralin interfaceEStructuralFeatureValueConverter- Parameters:
eObject- (optional)feature- the source featureinstance- the source value object- Returns:
- converted value (commonly a string literal)
-
fromString
protected java.lang.Object fromString(org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String literal)Convert literal to Object.- Parameters:
feature- target featureliteral- to convert- Returns:
- converted object
-
toString
protected java.lang.Object toString(org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object instance)Basic conversion from model to string literal.- Parameters:
feature- the feauterinstance- the model value- Returns:
- the string value
-
-