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.String
DEFAULT_LIST_SEPARATOR
Default list separator token.static double
DEFAULT_PRIORITY
The 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).protected
DefaultEAttributeValueConverterImpl(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.Object
convertToLiteral(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.Object
convertToModelValue(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.Object
fromString(org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String literal)
Convert literal to Object.double
isApplicable(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.Object
toString(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:EStructuralFeatureValueConverter
Check whether this converter instance is applicable for the given feature.- Specified by:
isApplicable
in 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:EStructuralFeatureValueConverter
Convert string literal to model value instance.- Specified by:
convertToModelValue
in 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:EStructuralFeatureValueConverter
Convert model value instance to string literal.- Specified by:
convertToLiteral
in 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
-
-