public final class InstanceUtils
extends java.lang.Object
Instance
s.Modifier and Type | Class and Description |
---|---|
static class |
InstanceUtils.NamePatternRec |
Modifier and Type | Method and Description |
---|---|
static Instance |
copy(Instance source)
Deprecated.
|
static void |
copy(Instance source,
Instance dest)
Deprecated.
|
static java.lang.String |
formatValuePath(java.lang.String[] path)
Converts an array of identifiers to a dot-separated string, enclosing identifiers, containing dots, in square
brackets.
|
static java.lang.String |
getInstanceName(Instance instance) |
static <T> T |
getValueEx(Instance instance,
java.lang.String propertyPath)
Get value of an attribute according to the rules described in
Instance.getValueEx(String) . |
static <T> T |
getValueEx(Instance instance,
java.lang.String[] properties)
Get value of an attribute according to the rules described in
Instance.getValueEx(String) . |
static InstanceUtils.NamePatternRec |
parseNamePattern(MetaClass metaClass)
Parse a name pattern defined by
NamePattern annotation. |
static java.lang.String[] |
parseValuePath(java.lang.String path)
Converts a string of identifiers separated by dots to an array.
|
static boolean |
propertyValueEquals(java.lang.Object a,
java.lang.Object b)
Used by
AbstractInstance to check whether property value has been changed. |
static void |
setValueEx(Instance instance,
java.lang.String[] properties,
java.lang.Object value)
Set value of an attribute according to the rules described in
Instance.setValueEx(String, Object) . |
static void |
setValueEx(Instance instance,
java.lang.String propertyPath,
java.lang.Object value)
Set value of an attribute according to the rules described in
Instance.setValueEx(String, Object) . |
public static java.lang.String[] parseValuePath(@Nullable java.lang.String path)
car.driver.name [car.field].driver.name
path
- value path as stringpublic static java.lang.String formatValuePath(java.lang.String[] path)
path
- value path as arraypublic static <T> T getValueEx(Instance instance, java.lang.String propertyPath)
Instance.getValueEx(String)
.instance
- instancepropertyPath
- attribute pathpublic static <T> T getValueEx(Instance instance, java.lang.String[] properties)
Instance.getValueEx(String)
.instance
- instanceproperties
- path to the attributepublic static void setValueEx(Instance instance, java.lang.String propertyPath, java.lang.Object value)
Instance.setValueEx(String, Object)
.instance
- instancepropertyPath
- path to the attributevalue
- attribute valuepublic static void setValueEx(Instance instance, java.lang.String[] properties, java.lang.Object value)
Instance.setValueEx(String, Object)
.instance
- instanceproperties
- path to the attributevalue
- attribute value@Deprecated public static Instance copy(Instance source)
@Deprecated public static void copy(Instance source, Instance dest)
public static java.lang.String getInstanceName(Instance instance)
instance
- instanceNamePattern
or toString()
.@Nullable public static InstanceUtils.NamePatternRec parseNamePattern(MetaClass metaClass)
NamePattern
annotation.metaClass
- entity meta-classpublic static boolean propertyValueEquals(java.lang.Object a, java.lang.Object b)
AbstractInstance
to check whether property value has been changed.a
- an objectb
- an objectAbstractInstance
returns true only if a are the same instance as b