Package eu.mihosoft.vmf.runtime.core
Class Property
java.lang.Object
eu.mihosoft.vmf.runtime.core.Property
Gives reflective access to an objects/types property. Property objects can be used to set and
unset properties as well as acquire type information as well as annotations. Additionally,
one can register change listeners.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvjavax.observer.Subscription
Adds the specified change listener to this property.annotationByKey
(String key) Returns the annotation specified by key.Returns the list of annotations of this object.get()
Returns the value of this property.Returns the default value of this property.getName()
Returns the name of this property.getType()
Returns the type of this property.boolean
isSet()
Indicates whether this property is set.static Property
newInstance
(VObjectInternal parent, String name, boolean staticOnly) Deprecated.void
Sets this property to the specified object.void
setDefault
(Object value) Deprecated.void
unset()
Unsets this property, i.e., resets it to the specified default values.
-
Method Details
-
newInstance
@Deprecated public static Property newInstance(VObjectInternal parent, String name, boolean staticOnly) Deprecated. -
isSet
public boolean isSet()Indicates whether this property is set. A property is defined as being set if the current value differs from the default value, i.e.,Objects.equals(property.get(),property.getDefault())
.- Returns:
true
if this property is set;false
otherwise
-
set
Sets this property to the specified object.- Parameters:
o
- object to set- See Also:
-
unset
public void unset()Unsets this property, i.e., resets it to the specified default values.- See Also:
-
get
Returns the value of this property.- Returns:
- value of this property
-
setDefault
Deprecated. -
getDefault
Returns the default value of this property.- Returns:
- default value of this property
- See Also:
-
getType
Returns the type of this property.- Returns:
- type of this property
-
getName
Returns the name of this property.- Returns:
- name of this property
-
annotations
Returns the list of annotations of this object.- Returns:
- the list of annotations of this object
-
annotationByKey
Returns the annotation specified by key.- Parameters:
key
- the key of the annotation to return- Returns:
- the annotation specified by key
-
addChangeListener
Adds the specified change listener to this property. Listeners will be notified about changes regardless of whether change recording is enabled. This allows to react to and/or undo specific changes without the overhead of storing all previous events in a collection. The listener registers with this property only.- Parameters:
l
- the listener to add- Returns:
- a subscription which allows to unsubscribe the specified listener
-