Package org.eclipse.m2m.atl.emftvm.util
Class EMFTVMUtil
- java.lang.Object
-
- org.eclipse.m2m.atl.emftvm.util.EMFTVMUtil
-
public final class EMFTVMUtil extends java.lang.Object
EMFTVM static utility methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EMFTVMUtil.RegistryTypeSwitch
Returns the registry type of the switched object.
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
DELIM_PATTERN
Type namespace matching pattern.static java.lang.String
INIT_OP_NAME
Name of the "init" static parameterless operation.static java.lang.String
MAIN_OP_NAME
Name of the "main" static parameterless operation.static java.lang.String
NATIVE
Native type namespace.static java.lang.String
NS_DELIM
Type namespace delimiter.static java.lang.String
XMI_ID_FEATURE
Name if the XMI ID feature forEObject
s contained inXMIResource
s.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
add(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value, int index)
Adds thevalue
ofeo.sf
.static Field
createField(java.lang.String name, boolean isStatic, java.lang.String[] context, java.lang.String[] type, CodeBlock initialiser)
Creates a newField
.static Operation
createOperation(boolean isStatic, java.lang.String name, java.lang.String[] context, java.lang.String[] returnType, java.lang.String[][][] parameters, CodeBlock body)
Creates a newOperation
.static java.lang.Object
emf2vm(ExecEnv env, org.eclipse.emf.ecore.EObject eo, java.lang.Object value)
Convertsvalue
to an EMFTVM value.static LazyList<org.eclipse.emf.ecore.EObject>
findAllInstances(org.eclipse.emf.ecore.EClass type, ExecEnv env)
Finds all instances of type in the registered input/inout models.static LazyList<org.eclipse.emf.ecore.EObject>
findAllInstIn(java.lang.Object modelname, org.eclipse.emf.ecore.EClass type, ExecEnv env)
Finds all instances of type in the given model.static java.lang.reflect.Constructor<?>
findConstructor(java.lang.Class<?> context, java.lang.Class<?>[] argTypes)
Looks for a native Java constructor.static java.lang.reflect.Method
findNativeMethod(java.lang.Class<?> context, java.lang.String opname, boolean isStatic)
Looks for a native Java method without arguments.static java.lang.reflect.Method
findNativeMethod(java.lang.Class<?> context, java.lang.String opname, java.lang.Class<?>[] argTypes, boolean isStatic)
Looks for a native Java method.static java.lang.reflect.Method
findNativeMethod(java.lang.Class<?> context, java.lang.String opname, java.lang.Class<?> argType, boolean isStatic)
Looks for a native Java method.static java.lang.reflect.Method
findNativeMethod(Operation op, java.lang.Object self, java.lang.String opname)
Looks for a native Java method without arguments.static java.lang.reflect.Method
findNativeMethod(Operation op, java.lang.Object self, java.lang.String opname, java.lang.Object arg)
Looks for a native Java method with one argument.static java.lang.reflect.Method
findNativeMethod(Operation op, java.lang.Object self, java.lang.String opname, java.lang.Object[] args)
Looks for a native Java method with multiple arguments.static java.lang.reflect.Method
findNativeSuperMethod(Operation op, java.lang.Class<?> context, java.lang.String opname)
Looks for a native superclass Java method without arguments.static java.lang.reflect.Method
findNativeSuperMethod(Operation op, java.lang.Class<?> context, java.lang.String opname, java.lang.Object arg)
Looks for a native superclass Java method with one argument.static java.lang.reflect.Method
findNativeSuperMethod(Operation op, java.lang.Class<?> context, java.lang.String opname, java.lang.Object[] args)
Looks for a native superclass Java method with multiple arguments.static java.lang.reflect.Method
findRootMethod(java.lang.reflect.Method method)
Finds the rootClass
declaration for the givenmethod
.static java.lang.Object
get(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf)
Retrieves the value ofeo.sf
.static java.lang.Class<?>[]
getArgumentClasses(java.lang.Object[] args)
Retrieves the classes ofargs
.static java.lang.Object
getArgumentType(java.lang.Object arg)
Retrieves the type ofarg
.static java.lang.Object[]
getArgumentTypes(java.lang.Object[] args)
Retrieves the types ofargs
.static Metamodel
getEcoreMetamodel()
Returns the singleton instance of the Ecore metamodel.static Metamodel
getEmfTvmMetamodel()
Returns the singleton instance of the EMFTVM metamodel.static java.io.File
getFile(java.lang.String path)
Returns the file with the givenpath
in the workspace, or the file in the filesystem if the workspace is not available.static java.util.Locale
getLocale(java.lang.String locale)
Returns theLocale
for the givenlocale
string.static double
getMethodCacheHitRate()
Returns the hit rate of the method cache.static java.lang.Object
getRegistryType(java.lang.Object type)
Returns the type object to use for the registry.static double
getRootMethodCacheHitRate()
Returns the hit rate of the root method cache.static Metamodel
getTraceMetamodel()
Returns the singleton instance of the Trace metamodel.static LazyList<java.lang.Object>
getTrans(java.lang.Object object, java.lang.reflect.Field field, LazyList<java.lang.Object> result)
Retrieves the transitive closure offield
onobject
.static LazyList<java.lang.Object>
getTrans(java.lang.Object object, Field field, StackFrame frame, LazyList<java.lang.Object> result)
Retrieves the transitive closure offield
onobject
.static LazyList<java.lang.Object>
getTrans(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature sf, ExecEnv env, LazyList<java.lang.Object> result)
Retrieves the transitive closure ofsf
onobject
.static java.lang.String
getTypeName(ExecEnv env, java.lang.Object type)
Returns the name oftype
, for printing.static java.lang.String
getTypeNames(ExecEnv env, java.lang.Object[] types)
Returns the names oftypes
, for printing.static java.lang.Object
invokeNative(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method)
Invokes native Javamethod
onself
without arguments.static java.lang.Object
invokeNative(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method, java.lang.Object arg)
Invokes native Javamethod
onself
with argumentarg
.static java.lang.Object
invokeNative(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method, java.lang.Object[] args)
Invokes native Javamethod
onself
with argumentsargs
.static java.lang.Object
invokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname)
Invokes native Java methodopname
onself
without arguments.static java.lang.Object
invokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object arg)
Invokes native Java methodopname
onself
with argumentarg
.static java.lang.Object
invokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object[] args)
Invokes native Java methodopname
onself
with argumentsargs
.static java.lang.Object
invokeNativeStatic(StackFrame frame, java.lang.Class<?> type, java.lang.String opname)
Invokes static native Java methodopname
without arguments.static java.lang.Object
invokeNativeStatic(StackFrame frame, java.lang.Class<?> type, java.lang.String opname, java.lang.Object arg)
Invokes static native Java methodopname
with argumentarg
.static java.lang.Object
invokeNativeStatic(StackFrame frame, java.lang.Class<?> type, java.lang.String opname, java.lang.Object[] args)
Invokes static native Java methodopname
with argumentsargs
.static void
registerEPackages(org.eclipse.emf.ecore.resource.ResourceSet rs)
Registers allEPackage
nsURIs inrs
in the localrs
EPackage.Registry
.static void
remove(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value)
Removes thevalue
fromeo.sf
.static void
set(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value)
Sets thevalue
ofeo.sf
.static java.lang.String
toPrettyString(java.lang.Object object, ExecEnv env)
Offers an alternative to the defaulttoString()
method.static java.lang.String
toPrettyString(java.util.Collection<?> coll, ExecEnv env)
Offers an alternative to the defaulttoString()
method.static <T> java.lang.String
toPrettyString(T[] array, ExecEnv env)
Offers an alternative to the defaulttoString()
method.static java.lang.Object
uncheckedGet(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf)
Retrieves the value ofeo.sf
.static boolean
writeToWithCharset(java.lang.String string, java.lang.String path, java.lang.String charset)
Writesstring
topath
with the givencharset
.
-
-
-
Field Detail
-
NATIVE
public static final java.lang.String NATIVE
Native type namespace.- See Also:
- Constant Field Values
-
NS_DELIM
public static final java.lang.String NS_DELIM
Type namespace delimiter.- See Also:
- Constant Field Values
-
DELIM_PATTERN
public static final java.util.regex.Pattern DELIM_PATTERN
Type namespace matching pattern.- See Also:
NS_DELIM
-
MAIN_OP_NAME
public static final java.lang.String MAIN_OP_NAME
Name of the "main" static parameterless operation.- See Also:
- Constant Field Values
-
INIT_OP_NAME
public static final java.lang.String INIT_OP_NAME
Name of the "init" static parameterless operation.- See Also:
- Constant Field Values
-
XMI_ID_FEATURE
public static final java.lang.String XMI_ID_FEATURE
Name if the XMI ID feature forEObject
s contained inXMIResource
s.- See Also:
- Constant Field Values
-
-
Method Detail
-
getTypeName
public static java.lang.String getTypeName(ExecEnv env, java.lang.Object type)
Returns the name oftype
, for printing.- Parameters:
env
- the currentExecEnv
type
- the type- Returns:
- the name of
type
, for printing
-
getTypeNames
public static java.lang.String getTypeNames(ExecEnv env, java.lang.Object[] types)
Returns the names oftypes
, for printing.- Parameters:
env
- the currentExecEnv
.types
- the types- Returns:
- the names of
types
, for printing
-
getRegistryType
public static java.lang.Object getRegistryType(java.lang.Object type) throws java.lang.IllegalArgumentException
Returns the type object to use for the registry.- Parameters:
type
- the type object- Returns:
- the type object to use for the registry
- Throws:
java.lang.IllegalArgumentException
- if type is a primitive EMF type without instance class
-
getEcoreMetamodel
public static Metamodel getEcoreMetamodel()
Returns the singleton instance of the Ecore metamodel.- Returns:
- the singleton instance of the Ecore metamodel
-
getEmfTvmMetamodel
public static Metamodel getEmfTvmMetamodel()
Returns the singleton instance of the EMFTVM metamodel.- Returns:
- the singleton instance of the EMFTVM metamodel
-
getTraceMetamodel
public static Metamodel getTraceMetamodel()
Returns the singleton instance of the Trace metamodel.- Returns:
- the singleton instance of the Trace metamodel
-
findAllInstances
public static LazyList<org.eclipse.emf.ecore.EObject> findAllInstances(org.eclipse.emf.ecore.EClass type, ExecEnv env)
Finds all instances of type in the registered input/inout models.- Parameters:
type
- the typeenv
- the currentExecEnv
- Returns:
- all instances of type in the registered input/inout models
-
findAllInstIn
public static LazyList<org.eclipse.emf.ecore.EObject> findAllInstIn(java.lang.Object modelname, org.eclipse.emf.ecore.EClass type, ExecEnv env)
Finds all instances of type in the given model.- Parameters:
modelname
- the model nametype
- the typeenv
- the currentExecEnv
- Returns:
- all instances of type in the given model
-
toPrettyString
public static java.lang.String toPrettyString(java.lang.Object object, ExecEnv env)
Offers an alternative to the defaulttoString()
method. Usesenv
to determine the containing model of types. Compensates forEObject
's notoriously badtoString()
.- Parameters:
object
-env
-- Returns:
- the string representation of
object
.
-
toPrettyString
public static java.lang.String toPrettyString(java.util.Collection<?> coll, ExecEnv env)
Offers an alternative to the defaulttoString()
method. Usesenv
to determine the containing model of types. Compensates forEObject
's notoriously badtoString()
.- Parameters:
coll
-env
-- Returns:
- the string representation of
coll
.
-
toPrettyString
public static <T> java.lang.String toPrettyString(T[] array, ExecEnv env)
Offers an alternative to the defaulttoString()
method. Usesenv
to determine the containing model of types. Compensates forEObject
's notoriously badtoString()
.- Parameters:
array
-env
-- Returns:
- the string representation of
coll
.
-
get
public static java.lang.Object get(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf)
Retrieves the value ofeo.sf
. Checks thateo
is not in an output model.- Parameters:
env
- the currentExecEnv
eo
- the model element to retrieve the value fromsf
- the structural feature to retrieve the value from- Returns:
- the value of
eo.sf
.
-
uncheckedGet
public static java.lang.Object uncheckedGet(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf)
Retrieves the value ofeo.sf
.- Parameters:
env
- the currentExecEnv
eo
- the model element to retrieve the value fromsf
- the structural feature to retrieve the value from- Returns:
- the value of
eo.sf
.
-
emf2vm
public static java.lang.Object emf2vm(ExecEnv env, org.eclipse.emf.ecore.EObject eo, java.lang.Object value)
Convertsvalue
to an EMFTVM value.- Parameters:
env
- the currentExecEnv
eo
- theEObject
from which the value was obtainedvalue
- the EMF value to convert- Returns:
- the EMFTVM value
-
set
public static void set(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value)
Sets thevalue
ofeo.sf
.- Parameters:
env
- the currentExecEnv
eo
- the model element to set the value forsf
- the structural feature to set the value forvalue
- the value to set
-
add
public static void add(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value, int index)
Adds thevalue
ofeo.sf
.- Parameters:
env
-eo
-sf
-value
-index
- the insertion index (-1 for end)
-
remove
public static void remove(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value)
Removes thevalue
fromeo.sf
.- Parameters:
env
-eo
-sf
-value
-
-
getArgumentTypes
public static java.lang.Object[] getArgumentTypes(java.lang.Object[] args)
Retrieves the types ofargs
.- Parameters:
args
-- Returns:
- the types of
args
-
getArgumentType
public static java.lang.Object getArgumentType(java.lang.Object arg)
Retrieves the type ofarg
.- Parameters:
arg
-- Returns:
- the type of
arg
-
invokeNative
public static java.lang.Object invokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object[] args)
Invokes native Java methodopname
onself
with argumentsargs
.- Parameters:
frame
- the current stack frameself
- the object on which to invoke the methodopname
- the method nameargs
- the method arguments- Returns:
- the method result
-
invokeNative
public static java.lang.Object invokeNative(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method, java.lang.Object[] args)
Invokes native Javamethod
onself
with argumentsargs
.- Parameters:
frame
- the current stack frameself
- the object on which to invoke the methodmethod
- the methodargs
- the method arguments- Returns:
- the method result
-
invokeNative
public static java.lang.Object invokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object arg)
Invokes native Java methodopname
onself
with argumentarg
.- Parameters:
frame
- the current stack frameself
- the object on which to invoke the methodopname
- the method namearg
- the method argument- Returns:
- the method result
-
invokeNative
public static java.lang.Object invokeNative(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method, java.lang.Object arg)
Invokes native Javamethod
onself
with argumentarg
.- Parameters:
frame
- the current stack frameself
- the object on which to invoke the methodmethod
- the methodarg
- the method argument- Returns:
- the method result
-
invokeNative
public static java.lang.Object invokeNative(StackFrame frame, java.lang.Object self, java.lang.String opname)
Invokes native Java methodopname
onself
without arguments.- Parameters:
frame
- the current stack frameself
- the object on which to invoke the methodopname
- the method name- Returns:
- the method result
-
invokeNative
public static java.lang.Object invokeNative(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method)
Invokes native Javamethod
onself
without arguments.- Parameters:
frame
- the current stack frameself
- the object on which to invoke the methodmethod
- the method- Returns:
- the method result
-
invokeNativeStatic
public static java.lang.Object invokeNativeStatic(StackFrame frame, java.lang.Class<?> type, java.lang.String opname, java.lang.Object[] args)
Invokes static native Java methodopname
with argumentsargs
.- Parameters:
frame
- the current stack frametype
- the class in which the static method is definedopname
- the method nameargs
- the method arguments- Returns:
- the method result
-
invokeNativeStatic
public static java.lang.Object invokeNativeStatic(StackFrame frame, java.lang.Class<?> type, java.lang.String opname, java.lang.Object arg)
Invokes static native Java methodopname
with argumentarg
.- Parameters:
frame
- the current stack frametype
- the class in which the static method is definedopname
- the method namearg
- the method arguments- Returns:
- the method result
-
invokeNativeStatic
public static java.lang.Object invokeNativeStatic(StackFrame frame, java.lang.Class<?> type, java.lang.String opname)
Invokes static native Java methodopname
without arguments.- Parameters:
frame
- the current stack frametype
- the class in which the static method is definedopname
- the method name- Returns:
- the method result
-
findNativeMethod
public static java.lang.reflect.Method findNativeMethod(java.lang.Class<?> context, java.lang.String opname, java.lang.Class<?>[] argTypes, boolean isStatic)
Looks for a native Java method.- Parameters:
context
- The class of the methodopname
- The method nameargTypes
- The types of all argumentsisStatic
- Whether to look for a static method or not- Returns:
- the method if found, null otherwise
-
findNativeMethod
public static java.lang.reflect.Method findNativeMethod(java.lang.Class<?> context, java.lang.String opname, java.lang.Class<?> argType, boolean isStatic)
Looks for a native Java method.- Parameters:
context
- The class of the methodopname
- The method nameargumentType
- The type of the argumentisStatic
- Whether to look for a static method or not- Returns:
- the method if found, null otherwise
-
findNativeMethod
public static java.lang.reflect.Method findNativeMethod(java.lang.Class<?> context, java.lang.String opname, boolean isStatic)
Looks for a native Java method without arguments.- Parameters:
context
- The class of the methodopname
- The method nameisStatic
- Whether to look for a static method or not- Returns:
- the method if found, null otherwise
-
findNativeMethod
public static java.lang.reflect.Method findNativeMethod(Operation op, java.lang.Object self, java.lang.String opname)
Looks for a native Java method without arguments.- Parameters:
op
- the previously found EMFTVMOperation
self
- the object on which to invoke the methodopname
- the method name- Returns:
- the method if found and more specific than
op
,null
otherwise
-
findNativeMethod
public static java.lang.reflect.Method findNativeMethod(Operation op, java.lang.Object self, java.lang.String opname, java.lang.Object arg)
Looks for a native Java method with one argument.- Parameters:
op
- the previously found EMFTVMOperation
self
- the object on which to invoke the methodopname
- the method namearg
- the method argument- Returns:
- the method if found and more specific than
op
,null
otherwise
-
findNativeMethod
public static java.lang.reflect.Method findNativeMethod(Operation op, java.lang.Object self, java.lang.String opname, java.lang.Object[] args)
Looks for a native Java method with multiple arguments.- Parameters:
op
- the previously found EMFTVMOperation
self
- the object on which to invoke the methodopname
- the method nameargs
- the method arguments- Returns:
- the method if found and more specific than
op
,null
otherwise
-
findNativeSuperMethod
public static java.lang.reflect.Method findNativeSuperMethod(Operation op, java.lang.Class<?> context, java.lang.String opname)
Looks for a native superclass Java method without arguments.- Parameters:
op
- the previously found EMFTVMOperation
context
- the context for which to find the superclass methodopname
- the method name- Returns:
- the method if found and more specific than
op
,null
otherwise
-
findNativeSuperMethod
public static java.lang.reflect.Method findNativeSuperMethod(Operation op, java.lang.Class<?> context, java.lang.String opname, java.lang.Object arg)
Looks for a native superclass Java method with one argument.- Parameters:
op
- the previously found EMFTVMOperation
context
- the context for which to find the superclass methodname
- the method namearg
- the method argument- Returns:
- the method if found and more specific than
op
,null
otherwise
-
findNativeSuperMethod
public static java.lang.reflect.Method findNativeSuperMethod(Operation op, java.lang.Class<?> context, java.lang.String opname, java.lang.Object[] args)
Looks for a native superclass Java method with multiple arguments.- Parameters:
op
- the previously found EMFTVMOperation
context
- the context for which to find the superclass methodname
- the method nameargs
- the method arguments- Returns:
- the method if found and more specific than
op
,null
otherwise
-
findConstructor
public static java.lang.reflect.Constructor<?> findConstructor(java.lang.Class<?> context, java.lang.Class<?>[] argTypes)
Looks for a native Java constructor.- Parameters:
context
- The class of the methodargumentTypes
- The types of all arguments- Returns:
- the constructor if found,
null
otherwise
-
getArgumentClasses
public static java.lang.Class<?>[] getArgumentClasses(java.lang.Object[] args)
Retrieves the classes ofargs
.- Parameters:
args
-- Returns:
- the classes of
args
-
writeToWithCharset
public static boolean writeToWithCharset(java.lang.String string, java.lang.String path, java.lang.String charset) throws java.io.IOException
Writesstring
topath
with the givencharset
.- Parameters:
string
- the string to writepath
- the path of the file to write tocharset
- the character set to use, or use default when null- Returns:
- true on success
- Throws:
java.io.IOException
- when writing fails
-
getFile
public static java.io.File getFile(java.lang.String path)
Returns the file with the givenpath
in the workspace, or the file in the filesystem if the workspace is not available.- Parameters:
path
- the absolute or relative path to a file.- Returns:
- the file in the workspace, or the file in the filesystem if the workspace is not available.
-
createOperation
public static Operation createOperation(boolean isStatic, java.lang.String name, java.lang.String[] context, java.lang.String[] returnType, java.lang.String[][][] parameters, CodeBlock body)
Creates a newOperation
.- Parameters:
isStatic
- whether the created operation is staticname
- operation namecontext
- operation context [type model, type name]returnType
- operation return [type model, type name]parameters
- operations parameters: [[[name], [type model, type name]], ...]body
- operation body- Returns:
- a new
Operation
. - See Also:
Types
-
createField
public static Field createField(java.lang.String name, boolean isStatic, java.lang.String[] context, java.lang.String[] type, CodeBlock initialiser)
Creates a newField
.
-
getTrans
public static LazyList<java.lang.Object> getTrans(java.lang.Object object, Field field, StackFrame frame, LazyList<java.lang.Object> result)
Retrieves the transitive closure offield
onobject
.- Parameters:
object
- the object on which to retrievefield
field
- the field for which to retrieve the valueframe
- the currentStackFrame
result
- the intermediate list of values- Returns:
- the updated result
-
getTrans
public static LazyList<java.lang.Object> getTrans(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature sf, ExecEnv env, LazyList<java.lang.Object> result)
Retrieves the transitive closure ofsf
onobject
.- Parameters:
object
- the object on which to retrievesf
sf
- the structural feature for which to retrieve the valueenv
- the currentExecEnv
result
- the intermediate list of values- Returns:
- the updated result
-
getTrans
public static LazyList<java.lang.Object> getTrans(java.lang.Object object, java.lang.reflect.Field field, LazyList<java.lang.Object> result) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
Retrieves the transitive closure offield
onobject
.- Parameters:
object
- the object on which to retrievefield
field
- the field for which to retrieve the valueresult
- the intermediate list of values- Returns:
- the updated result
- Throws:
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
-
getLocale
public static java.util.Locale getLocale(java.lang.String locale)
Returns theLocale
for the givenlocale
string.- Parameters:
locale
- the locale string (e.g. "nl_BE", "es_ES_Traditional_WIN")- Returns:
- the
Locale
for the givenlocale
string
-
registerEPackages
public static void registerEPackages(org.eclipse.emf.ecore.resource.ResourceSet rs)
Registers allEPackage
nsURIs inrs
in the localrs
EPackage.Registry
. Sets theEPackage
nsURI to theEPackage
name if not set.- Parameters:
rs
- theResourceSet
-
findRootMethod
public static java.lang.reflect.Method findRootMethod(java.lang.reflect.Method method)
Finds the rootClass
declaration for the givenmethod
.- Parameters:
method
- the method for which to find the root declaration- Returns:
- the root
Method
-
getMethodCacheHitRate
public static double getMethodCacheHitRate()
Returns the hit rate of the method cache.- Returns:
- the hit rate of the method cache, or
-1.0
if no hits were recorded yet
-
getRootMethodCacheHitRate
public static double getRootMethodCacheHitRate()
Returns the hit rate of the root method cache.- Returns:
- the hit rate of the root method cache, or
-1.0
if no hits were recorded yet
-
-