public class PropertyUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static NamedValue |
createEnumValue(EnumerationLiteral literal)
Create a enumeration value from an enumeration literal.
|
static RangeValue |
createIntegerRangeValue(long min,
long max)
Creates a PropertyValue for a range of aadlinteger.
|
static RangeValue |
createIntegerRangeValue(long min,
long max,
long delta)
Creates a PropertyValue for a range of aadlinteger.
|
static RangeValue |
createIntegerRangeValue(long min,
UnitLiteral minUnits,
long max,
UnitLiteral maxUnits)
Creates a PropertyValue for a range of aadlinteger with units.
|
static RangeValue |
createIntegerRangeValue(long min,
UnitLiteral minUnits,
long max,
UnitLiteral maxUnits,
long delta,
UnitLiteral deltaUnits)
Creates a PropertyValue for a range of aadlinteger with units.
|
static IntegerLiteral |
createIntegerValue(long intValue)
Creates a PropertyValue for an aadlinteger.
|
static IntegerLiteral |
createIntegerValue(long intValue,
UnitLiteral unit)
Creates a PropertyValue for an aadlinteger with units.
|
static RangeValue |
createRealRangeValue(double min,
double max)
Creates a PropertyValue for a range of aadlreal.
|
static RangeValue |
createRealRangeValue(double min,
double max,
double delta)
Creates a PropertyValue for a range of aadlreal.
|
static RangeValue |
createRealRangeValue(double min,
UnitLiteral minUnits,
double max,
UnitLiteral maxUnits)
Creates a PropertyValue for a range of aadlreal with units.
|
static RangeValue |
createRealRangeValue(double min,
UnitLiteral minUnits,
double max,
UnitLiteral maxUnits,
double delta,
UnitLiteral deltaUnits)
Creates a PropertyValue for a range of aadlreal with units.
|
static RealLiteral |
createRealValue(double realValue)
Creates a PropertyValue for an aadlreal.
|
static RealLiteral |
createRealValue(double realValue,
UnitLiteral unit)
Creates a PropertyValue for an aadlreal with units.
|
static StringLiteral |
createStringValue(java.lang.String stringValue)
Creates a PropertyValue for a string.
|
static BooleanLiteral |
createTrueFalseValue(boolean boolValue)
Creates a PropertyValue for an aadlboolean.
|
static boolean |
getBooleanValue(NamedElement ph,
Property pd)
Get a non-modal boolean property value.
|
static boolean |
getBooleanValue(NamedElement ph,
Property pd,
boolean defaultVal)
Get a non-modal boolean property value.
|
static Classifier |
getClassifierReference(NamedElement ph,
Property pd) |
static PropertyExpression |
getContainedSimplePropertyValue(NamedElement context,
NamedElement target,
Property pd)
get a property association from the properties section of the containing classifier if the context.
|
static EnumerationLiteral |
getEnumLiteral(NamedElement ph,
Property pd)
Get a non-modal enumeration property value.
|
static InstanceObject |
getInstanceObjectReference(InstanceObject io,
Property pd)
Get an InstanceObject from an instance reference value.
|
static long |
getIntegerValue(NamedElement ph,
Property pd)
Get a non-modal integer property value with no units.
|
static long |
getIntegerValue(NamedElement ph,
Property pd,
long defaultVal)
Get a non-modal integer property value with no units.
|
static double |
getRealValue(NamedElement ph,
Property pd)
Get a non-modal real property with no units Throws an exception if no
property value exists or an error occurs.
|
static double |
getRealValue(NamedElement ph,
Property pd,
double defaultVal)
Get a non-modal real property value with no units.
|
static PropertyExpression |
getRecordFieldValue(RecordValue rv,
java.lang.String fieldName) |
static double |
getScaledNumberValue(NamedElement ph,
Property pd,
UnitLiteral unit)
Get a non-modal numeric property value scaled to the given unit.
|
static double |
getScaledNumberValue(NamedElement ph,
Property pd,
UnitLiteral unit,
double defaultVal)
Get a non-modal numeric property value scaled to the given unit.
|
static double |
getScaledRangeDelta(NamedElement ph,
Property pd,
UnitLiteral unit)
Return the delta value of a non-modal range property value scaled to a
given unit.
|
static double |
getScaledRangeDelta(NamedElement ph,
Property pd,
UnitLiteral unit,
double defaultVal)
Return the delta value of a non-modal range property value scaled to a
given unit.
|
static double |
getScaledRangeMaximum(NamedElement ph,
Property pd,
UnitLiteral unit)
Return the maximum value of a non-modal range property value scaled to a
given unit.
|
static double |
getScaledRangeMaximum(NamedElement ne,
Property pd,
UnitLiteral unit,
double defaultVal)
Return the maximum value of a non-modal range property value scaled to a
given unit.
|
static double |
getScaledRangeMinimum(NamedElement ph,
Property pd,
UnitLiteral unit)
Return the minimum value of a non-modal range property value scaled to a
given unit.
|
static double |
getScaledRangeMinimum(NamedElement ph,
Property pd,
UnitLiteral unit,
double defaultVal)
Return the minimum value of a non-modal range property value scaled to a
given unit.
|
static PropertyExpression |
getSimplePropertyListValue(NamedElement ph,
Property pd)
get non-model proeprty list value
|
static PropertyExpression |
getSimplePropertyValue(NamedElement ph,
Property pd)
Check that ph is not null and returns the property value by calling
ph.getSimplePropertyValue(pd)
|
static java.lang.String |
getStringValue(NamedElement ph,
Property pd)
Get a non-modal string property value.
|
public static long getIntegerValue(NamedElement ph, Property pd, long defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.defaultVal
- The value to return if the property has no value.public static long getIntegerValue(NamedElement ph, Property pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if ph or pd is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not an integer
value.public static double getRealValue(NamedElement ph, Property pd, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.defaultVal
- The value to return if the property has no value.public static double getRealValue(NamedElement ph, Property pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if ph or pd is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not a real
value.public static java.lang.String getStringValue(NamedElement ph, Property pd)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if ph or pd is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not a string
value.public static PropertyExpression getRecordFieldValue(RecordValue rv, java.lang.String fieldName)
public static boolean getBooleanValue(NamedElement ph, Property pd, boolean defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.defaultVal
- The value to return if the property has no value.public static boolean getBooleanValue(NamedElement ph, Property pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if ph or pd is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not a
TrueFalseValue
value.public static EnumerationLiteral getEnumLiteral(NamedElement ph, Property pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if ph or pd is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not an
enumeration value.public static double getScaledNumberValue(NamedElement ph, Property pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.public static double getScaledNumberValue(NamedElement ph, Property pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if the given unit literal is not
from the property's unit type or if ph, pd, or unit is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not a number
value.public static double getScaledRangeMaximum(NamedElement ne, Property pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.public static double getScaledRangeMaximum(NamedElement ph, Property pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if the given unit literal is not
from the property's unit type or if ph, pd, or unit is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not a range
value.public static double getScaledRangeMinimum(NamedElement ph, Property pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.public static double getScaledRangeMinimum(NamedElement ph, Property pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if the given unit literal is not
from the property's unit type or if ph, pd, or unit is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not a range
value.public static double getScaledRangeDelta(NamedElement ph, Property pd, UnitLiteral unit, double defaultVal)
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.defaultVal
- The value to return if the property has no value.public static double getScaledRangeDelta(NamedElement ph, Property pd, UnitLiteral unit) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException, java.lang.ClassCastException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.unit
- The unit to scale the value to.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if the given unit literal is not
from the property's unit type or if ph, pd, or unit is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.java.lang.ClassCastException
- Thrown if the retrieved value is not a range
value.public static InstanceObject getInstanceObjectReference(InstanceObject io, Property pd)
io
- The instance object from which to retrieve the property value.
(We don't use a property holder because we can only get an
instance reference value as a property value from an instance
object.)pd
- The property to retrieve.public static Classifier getClassifierReference(NamedElement ph, Property pd)
public static IntegerLiteral createIntegerValue(long intValue)
public static IntegerLiteral createIntegerValue(long intValue, UnitLiteral unit) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if unit is null.public static RangeValue createIntegerRangeValue(long min, long max) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue createIntegerRangeValue(long min, UnitLiteral minUnits, long max, UnitLiteral maxUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits or maxUnits is null,
if minUnits and maxUnits are not of the same UnitType, or if
min is greater than max.public static RangeValue createIntegerRangeValue(long min, long max, long delta) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue createIntegerRangeValue(long min, UnitLiteral minUnits, long max, UnitLiteral maxUnits, long delta, UnitLiteral deltaUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits, maxUnits, or
deltaUnits is null, if minUnits, maxUnits, and deltaUnits are
not of the same UnitType, or if min is greater than max.public static RealLiteral createRealValue(double realValue)
public static RealLiteral createRealValue(double realValue, UnitLiteral unit) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if unit is null.public static RangeValue createRealRangeValue(double min, double max) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue createRealRangeValue(double min, UnitLiteral minUnits, double max, UnitLiteral maxUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits or maxUnits is null,
if minUnits and maxUnits are not of the same UnitType, or if
min is greater than max.public static RangeValue createRealRangeValue(double min, double max, double delta) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if min is greater than max.public static RangeValue createRealRangeValue(double min, UnitLiteral minUnits, double max, UnitLiteral maxUnits, double delta, UnitLiteral deltaUnits) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if minUnits, maxUnits, or
deltaUnits is null, if minUnits, maxUnits, and deltaUnits are
not of the same UnitType, or if min is greater than max.public static StringLiteral createStringValue(java.lang.String stringValue) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- Thrown if stringValue is null.public static BooleanLiteral createTrueFalseValue(boolean boolValue)
public static NamedValue createEnumValue(EnumerationLiteral literal) throws java.lang.IllegalArgumentException
literal
- The enumeration literaljava.lang.IllegalArgumentException
- Thrown if literal is nullpublic static PropertyExpression getSimplePropertyValue(NamedElement ph, Property pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException
ph
- The property holder from which to retrieve the property value.pd
- The property to retrieve.InvalidModelException
- Thrown if the property value cannot be
retrieved because the model is incomplete or otherwise
invalid.PropertyNotPresentException
- Thrown if the property is undefined
for ph.PropertyIsModalException
- Thrown if ph is modal and declarative.java.lang.IllegalStateException
- Thrown if the lookup encounters a cycle of
property reference dependencies.java.lang.IllegalArgumentException
- Thrown if ph or pd is null.PropertyDoesNotApplyToHolderException
- Thrown if pd does not apply
to ph.PropertyIsListException
- Thrown if the property is not scalar.public static PropertyExpression getSimplePropertyListValue(NamedElement ph, Property pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException
InvalidModelException
PropertyNotPresentException
PropertyIsModalException
java.lang.IllegalStateException
java.lang.IllegalArgumentException
PropertyDoesNotApplyToHolderException
PropertyIsListException
public static PropertyExpression getContainedSimplePropertyValue(NamedElement context, NamedElement target, Property pd)
context
- NamedElement whose containing classifier's properties section is searched for the desired propertytarget
- NamedElement the model element to which the property is applied to via the applies to clausepd
- Property the property definition