public final class EmfUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
eWordsForValue |
static java.lang.String[] |
oWordsForValue |
static java.lang.String[] |
wordsForType |
Constructor and Description |
---|
EmfUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?> |
asClass(java.lang.Object obj,
SeenSet<java.lang.Object> seen) |
static java.util.List<java.lang.Object> |
collectOrFilter(CollectionAdder adder,
java.util.Collection<java.lang.Object> elements,
boolean collect,
boolean onlyOne,
boolean useName,
boolean useType,
boolean useValue,
boolean searchJava,
java.lang.Object... filters) |
static java.lang.Object |
collectOrFilter(CollectionAdder adder,
java.lang.Object obj,
boolean collect,
boolean onlyOne,
boolean useName,
boolean useType,
boolean useValue,
boolean searchJava,
java.lang.Object... filters) |
static boolean |
contains(org.eclipse.emf.ecore.EObject outer,
org.eclipse.emf.ecore.EObject inner) |
static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> |
findStructuralFeaturesMatching(org.eclipse.emf.ecore.EObject eObj,
boolean strictMatch,
boolean justfirst,
java.lang.String... possibleNames) |
static java.util.Set<org.eclipse.emf.ecore.EObject> |
getEObjectsOfType(org.eclipse.emf.ecore.EObject o,
java.lang.Class<?> type) |
static void |
getEObjectsOfType(org.eclipse.emf.ecore.EObject o,
java.lang.Class<?> type,
java.util.Set<org.eclipse.emf.ecore.EObject> set) |
static <TT> java.util.List<TT> |
getEValues(org.eclipse.emf.ecore.EObject eObj,
java.lang.Class<TT> cls,
boolean propagate,
boolean strictMatch,
boolean justFirst,
boolean complainIfNotFound,
SeenSet<java.lang.Object> seen) |
static <T> java.util.List<T> |
getFieldValues(java.lang.Object o,
boolean includeStatic) |
static <T> java.util.List<T> |
getFieldValues(java.lang.Object o,
java.lang.Class<T> cls,
boolean propagate,
boolean strictMatch,
boolean justFirst,
java.lang.String... specifiers)
Get methods whose names are variations of those specified and return the
results of their invocations.
|
static java.lang.Object |
getMemberValue(java.lang.Object o,
java.lang.String specifier,
boolean propagate,
boolean strictMatch)
Get the value of the object's field with the specified name (or some
close variation).
|
static <T> java.util.List<T> |
getMemberValues(java.lang.Object o,
java.lang.Class<T> cls,
boolean propagate,
boolean strictMatch,
boolean justFirst,
java.lang.String... specifiers)
Get the values of the object's fields that have one the specified names
(or some close variation).
|
static <T> java.util.List<T> |
getMethodResults(java.lang.Object o,
java.lang.Class<T> cls,
boolean propagate,
boolean strictMatch,
boolean justFirst,
java.lang.String... specifiers)
Get the values of the object's fields that have one the specified names
(or, if not strict, some close variation).
|
static java.lang.String |
getName(java.lang.Object o) |
static java.util.List<java.lang.String> |
getPossibleFieldNames(java.lang.String specifier) |
static java.util.List<java.lang.String> |
getPossibleMethodNames(java.lang.String specifier) |
static java.util.List<java.lang.String> |
getPossibleMethodNames(java.lang.String specifier,
java.lang.String... methodPrefixes) |
static java.util.List<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element> |
getRelationships(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element elem) |
static java.lang.Class<?> |
getType(org.eclipse.emf.ecore.EObject eObj) |
static java.lang.Class<?> |
getType(org.eclipse.emf.ecore.EObject eObj,
boolean strictMatch) |
static java.lang.Class<?> |
getType(java.lang.Object o) |
static java.lang.String |
getTypeName(java.lang.Object o) |
static java.util.Collection<java.lang.String> |
getTypeNames(java.lang.Object o) |
static java.util.List<java.lang.Object> |
getTypeObjects(org.eclipse.emf.ecore.EObject eObj,
boolean propagate,
boolean strictMatch,
boolean justFirst,
boolean complainIfNotFound,
SeenSet<java.lang.Object> seen) |
static java.util.List<java.lang.Class<?>> |
getTypes(org.eclipse.emf.ecore.EObject eObj,
boolean propagate,
boolean strictMatch,
boolean justFirst,
boolean complainIfNotFound,
SeenSet<java.lang.Object> seen) |
static java.util.Collection<java.lang.Class<?>> |
getTypes(java.lang.Object o) |
static <TT> TT |
getValue(java.lang.Object obj,
java.lang.Class<TT> cls,
boolean propagate,
boolean strictMatch,
boolean complainIfNotFound)
Get a "value" corresponding to the
Object that are instances of
the input Class type. |
static <TT> java.util.List<TT> |
getValues(java.lang.Object obj,
java.lang.Class<TT> cls,
boolean propagate,
boolean strictMatch,
boolean justFirst,
boolean complainIfNotFound,
SeenSet<java.lang.Object> seen)
Get "values" corresponding to the
Object that are instances of
the input Class type. |
static boolean |
matches(java.lang.Object obj,
boolean useName,
boolean useType,
java.lang.Object[] patterns) |
static boolean |
matches(java.lang.Object obj,
java.lang.Object pattern)
Determine
|
static boolean |
matches(java.lang.Object obj,
java.lang.Object pattern,
boolean useName,
boolean useType) |
static boolean |
matches(java.lang.String s,
java.lang.String pattern) |
static java.lang.String |
toString(java.lang.Object o) |
static <T> boolean |
trueOrNotNull(Pair<java.lang.Boolean,T> p)
Determines the validity of a return value packaged with a
Boolean
in a Pair . |
public static java.lang.String[] wordsForType
public static java.lang.String[] eWordsForValue
public static java.lang.String[] oWordsForValue
public static java.lang.String toString(java.lang.Object o)
public static java.util.List<java.lang.String> getPossibleFieldNames(java.lang.String specifier)
specifier
- public static java.util.List<java.lang.String> getPossibleMethodNames(java.lang.String specifier)
specifier
- public static java.util.List<java.lang.String> getPossibleMethodNames(java.lang.String specifier, java.lang.String... methodPrefixes)
specifier
- methodPrefixes
- public static <T> boolean trueOrNotNull(Pair<java.lang.Boolean,T> p)
Boolean
in a Pair
.
A method may return a success/fail Boolean
with another return
value in a pair. For example, a getValue() method may want to return null
sometimes as a valid value and at other times as an invalid value.
The Boolean
may be null, which this method assumes means that
success is "unknown." When unknown, this method gives the benefit of the
doubt for non-null return values, so true is returned for Pair(null,
nonNullT), and false for Pair(null,null), assuming that an unsuccessful
call always has a null return value.
p
- a return value from another function paired with a success
flag, Pair(Boolean success, T returnValue).public static <T> java.util.List<T> getMethodResults(java.lang.Object o, java.lang.Class<T> cls, boolean propagate, boolean strictMatch, boolean justFirst, java.lang.String... specifiers)
Class
. If cls is null, return all
values for matching fields.o
- cls
- propagate
- justFirst
- specifiers
- public static <T> java.util.List<T> getFieldValues(java.lang.Object o, java.lang.Class<T> cls, boolean propagate, boolean strictMatch, boolean justFirst, java.lang.String... specifiers)
Class
. If cls is null, return all values for
matching members.o
- cls
- propagate
- justFirst
- specifiers
- public static <T> java.util.List<T> getFieldValues(java.lang.Object o, boolean includeStatic)
public static java.lang.Object getMemberValue(java.lang.Object o, java.lang.String specifier, boolean propagate, boolean strictMatch)
o
- specifier
- propagate
- public static <T> java.util.List<T> getMemberValues(java.lang.Object o, java.lang.Class<T> cls, boolean propagate, boolean strictMatch, boolean justFirst, java.lang.String... specifiers)
Class
. If cls is null,
return all values for matching members.o
- cls
- propagate
- justFirst
- specifiers
- strictMatch
- public static java.util.Collection<java.lang.Class<?>> getTypes(java.lang.Object o)
public static java.lang.Class<?> getType(java.lang.Object o)
public static java.lang.String getTypeName(java.lang.Object o)
public static java.util.Collection<java.lang.String> getTypeNames(java.lang.Object o)
public static java.lang.String getName(java.lang.Object o)
public static void getEObjectsOfType(org.eclipse.emf.ecore.EObject o, java.lang.Class<?> type, java.util.Set<org.eclipse.emf.ecore.EObject> set)
public static java.util.Set<org.eclipse.emf.ecore.EObject> getEObjectsOfType(org.eclipse.emf.ecore.EObject o, java.lang.Class<?> type)
public static boolean contains(org.eclipse.emf.ecore.EObject outer, org.eclipse.emf.ecore.EObject inner)
public static <TT> java.util.List<TT> getEValues(org.eclipse.emf.ecore.EObject eObj, java.lang.Class<TT> cls, boolean propagate, boolean strictMatch, boolean justFirst, boolean complainIfNotFound, SeenSet<java.lang.Object> seen)
eObj
- cls
- propagate
- whether to propagate value dependencies through Expressions.strictMatch
- justFirst
- public static <TT> TT getValue(java.lang.Object obj, java.lang.Class<TT> cls, boolean propagate, boolean strictMatch, boolean complainIfNotFound)
Object
that are instances of
the input Class
type.obj
- cls
- propagate
- strictMatch
- complainIfNotFound
- public static <TT> java.util.List<TT> getValues(java.lang.Object obj, java.lang.Class<TT> cls, boolean propagate, boolean strictMatch, boolean justFirst, boolean complainIfNotFound, SeenSet<java.lang.Object> seen)
Object
that are instances of
the input Class
type.obj
- cls
- propagate
- strictMatch
- justFirst
- complainIfNotFound
- public static java.util.List<org.eclipse.emf.ecore.EStructuralFeature> findStructuralFeaturesMatching(org.eclipse.emf.ecore.EObject eObj, boolean strictMatch, boolean justfirst, java.lang.String... possibleNames)
public static java.lang.Class<?> getType(org.eclipse.emf.ecore.EObject eObj)
public static java.lang.Class<?> getType(org.eclipse.emf.ecore.EObject eObj, boolean strictMatch)
public static java.lang.Class<?> asClass(java.lang.Object obj, SeenSet<java.lang.Object> seen)
public static java.util.List<java.lang.Class<?>> getTypes(org.eclipse.emf.ecore.EObject eObj, boolean propagate, boolean strictMatch, boolean justFirst, boolean complainIfNotFound, SeenSet<java.lang.Object> seen)
public static java.util.List<java.lang.Object> getTypeObjects(org.eclipse.emf.ecore.EObject eObj, boolean propagate, boolean strictMatch, boolean justFirst, boolean complainIfNotFound, SeenSet<java.lang.Object> seen)
public static java.util.List<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element> getRelationships(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element elem)
public static boolean matches(java.lang.String s, java.lang.String pattern)
public static boolean matches(java.lang.Object obj, java.lang.Object pattern)
obj
- pattern
- public static boolean matches(java.lang.Object obj, boolean useName, boolean useType, java.lang.Object[] patterns)
public static boolean matches(java.lang.Object obj, java.lang.Object pattern, boolean useName, boolean useType)
public static java.lang.Object collectOrFilter(CollectionAdder adder, java.lang.Object obj, boolean collect, boolean onlyOne, boolean useName, boolean useType, boolean useValue, boolean searchJava, java.lang.Object... filters)
public static java.util.List<java.lang.Object> collectOrFilter(CollectionAdder adder, java.util.Collection<java.lang.Object> elements, boolean collect, boolean onlyOne, boolean useName, boolean useType, boolean useValue, boolean searchJava, java.lang.Object... filters)