public class EMFUtils extends Object
Constructor and Description |
---|
EMFUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
add(EObject eobject,
EStructuralFeature feature,
Object value)
Adds a value to a multi-valued propert of an eobject.
|
static void |
add(EObject eobject,
String property,
Object value)
Adds a value to a multi-valued propert of an eobject.
|
static EObject |
clone(EObject prototype,
EFactory factory)
Deprecated.
|
static EObject |
clone(EObject prototype,
EFactory factory,
boolean deep)
Clones an eobject, with the option of performing a deep clone in which referenced eobjects
are also cloned.
|
static void |
copy(EObject source,
EObject target)
Copies all the properties from one object to anoter.
|
static EStructuralFeature |
feature(EObject eobject,
String property)
Method which looks up a structure feature of an eobject, first doing an exact name match,
then a case insensitive one.
|
static List |
features(EObject eobject,
Class propertyType)
Method which looks up structural features of an eobject by type.
|
static Object |
get(EObject eobject,
String property)
Gets the property of an eobject.
|
static List |
get(List objects,
String property)
Obtains the values of a particular property on each
EObject in a list. |
static Object |
getFromMap(EObject eobject,
String property,
Object key)
Returns a value from a map based property of an eobject.
|
static Object |
getFromMapSafe(EObject eobject,
String property,
String key)
Returns a value from a map based property of an eobject, handling null cases and the case
where the property is not actually a map.
|
static boolean |
has(EObject eobject,
String property)
Determines if an eobject has a particular property.
|
static boolean |
isCollection(EObject eobject,
EStructuralFeature feature)
Determines if a feature of an eobject is a collection.
|
static boolean |
isCollection(EObject eobject,
String property)
Determines if a property of an eobject is a collection.
|
static boolean |
isSet(EObject eobject,
String property)
Determines if a particular propety has been set on an eobject.
|
static boolean |
isSet(List objects,
String property)
Determines if a particular propety has been set on each
EObject in a list. |
static boolean |
isUnset(List objects,
String property)
Determines if a particular propety is unset on each
EObject in a list. |
static void |
set(EObject eobject,
String property,
Object value)
Sets a property of an eobject.
|
static void |
set(List objects,
String property,
List values)
Sets a particular property on each
EObject in a list to a particular value. |
static void |
set(List objects,
String property,
Object value)
Sets a particular property on each
EObject in a list to a particular value. |
public static boolean has(EObject eobject, String property)
eobject
- The eobject.property
- The property to check for.true
if the property exists, otherwise false
public static void set(EObject eobject, String property, Object value)
eobject
- THe object.property
- The property to set.value
- The value of the property.public static Object get(EObject eobject, String property)
eobject
- The object.property
- The property to get.public static Object getFromMap(EObject eobject, String property, Object key)
This method does not sort of checking of the property, use getFromMapSafe(EObject,
String, String)
for more leniency.
eobject
- The object.property
- The map property.key
- The key to obtain from the map.null
.public static Object getFromMapSafe(EObject eobject, String property, String key)
This method returns null in cases where the the property does not exist, or it is not a map.
eobject
- The object.property
- The map property.key
- The key to obtain from the map.null
.public static void add(EObject eobject, String property, Object value)
The property must map to a multi-valued property of the eobject. The isCollection(EObject, String)
method can be used to test this.
eobject
- The object.property
- The multi-valued property.value
- The value to add.public static void add(EObject eobject, EStructuralFeature feature, Object value)
The feature must map to a multi-valued property of the eobject. The #isCollection(EStructuralFeature)
method can be used to test this.
eobject
- The object.feature
- The multi-valued feature.value
- The value to add.public static boolean isCollection(EObject eobject, String property)
In the event the property does not exist, this method will return false
true
if hte property is a collection, otherwise false
public static boolean isCollection(EObject eobject, EStructuralFeature feature)
true
if the feature is a collection, otherwise false
public static EStructuralFeature feature(EObject eobject, String property)
eobject
- The eobject.property
- The propertynull
if not found.public static List features(EObject eobject, Class propertyType)
eobject
- The eobject.propertyType
- The type of the properties.public static void set(List objects, String property, List values)
EObject
in a list to a particular value.
The following must hold:
objects.size() == values.size()
objects
- A list of EObject
.property
- The property to set on each eobject in objects
values
- The value to set on each eobjct in objects
public static void set(List objects, String property, Object value)
EObject
in a list to a particular value.
objects
- A list of EObject
.property
- The property to set on each eobject in objects
value
- The value to set on each eobjct in objects
public static List get(List objects, String property)
EObject
in a list.objects
- A list of EObject
.property
- The property to obtain.public static boolean isSet(EObject eobject, String property)
eobjects
- The eobject.property
- The property to check.true
if the property has been set, otherwise false
public static boolean isSet(List objects, String property)
EObject
in a list.objects
- A list of EObject
property
- The property to check.true
if every element in the list has been set, otherwise false
public static boolean isUnset(List objects, String property)
EObject
in a list.objects
- A list of EObject
property
- The property to check.true
if every element in the list is unset, otherwise false
public static EObject clone(EObject prototype, EFactory factory)
clone(EObject, EFactory, boolean)
.prototype
- The object to be cloned from.factory
- The factory used to create the clone.public static EObject clone(EObject prototype, EFactory factory, boolean deep)
prototype
- The object to be cloned from.factory
- The factory used to create the clone.deepFlag
- indicating wether to perform a deep clone.public static void copy(EObject source, EObject target)
source
- The object to copy from.target
- The object to copy to.Copyright © 1996–2019 Geotools. All rights reserved.