Interface PropertyValueSource
- All Known Subinterfaces:
AlarmDefinition
,AlarmEvent
,AuthenticatedUser
,BoundPropertySet
,MutablePropertyValueSource
,NotificationContext
,ObservablePropertySet
,ObservablePropertySource
,PropertySet
,PropertySetEdit
,PyAlarmEvent
,QualifiedValuePropertySet
,QualifiedValuePropertySource
,TagConfiguration
,TagConfigurationModel
,TagEditController<T>
,TagGroup
,User
,VersionedPropertySet
- All Known Implementing Classes:
AbstractExtendedPropertySet
,ADSSOAuthChallenge
,AlarmDefinitionConfig
,AlarmDefinitionDiff
,AlarmEventInstance
,AuthChallenge
,BadgeAuthChallenge
,BasicAlarmDefinition
,BasicAlarmEvent
,BasicAuthChallenge
,BasicAuthenticatedUser
,BasicBoundPropertySet
,BasicPropertySet
,BasicTagConfiguration
,BasicTagConfigurationModel
,BasicTagEditController
,BasicUser
,BasicVersionedPropertySet
,BoundExtendedPropertySet
,BoundPropertySetConfig
,BoundPropertySetDiff
,ChartUIElement
,ComplexTagDefinition
,ComplexTagDiff
,CompositePropertySet
,DelegatePropertySet
,EventData
,ExtendedAlarmDefinition
,ExtendedPropertySet
,IdentityTraits
,ImmutablePropertySet
,IntersectedAlarmDefinition
,IntersectedBoundPropertySet
,IntersectedPropertySet
,IntersectedTagConfig
,IntersectedTagEditModel
,NodeDescription
,PipelineDescriptor
,PropertySetConfig
,PropertySetDiff
,PyAlarmEventImpl
,PyUser
,StorageTagConfiguration
,TagDefinition
,TagDiff
,TagEditResources
,TagPropertySetWrapper
,UnfilteredEventData
public interface PropertyValueSource
This interface represents a specific subset of functionality implemented by most property holders (such as
PropertySet
), used to retrieve property values.-
Method Summary
Modifier and TypeMethodDescriptionboolean
<T> T
Retrieves the value of the property, or null if this set doesn't contain that property.default <T> T
getNonNull
(Property<T> prop, Supplier<T> supplier) The value for prop if it exists and is not null.default <T> T
getNonNull
(Property<T> prop, T value) The value for prop if it exists and is not null.default <T> T
getOrDefault
(Property<T> prop) <T> T
Get the value for a givenProperty
, or else fall back to value if it's not present.Collection<Property<?>>
default List<PropertyValue>
Returns the opaque PropertyValue objects.
-
Method Details
-
getProperties
Collection<Property<?>> getProperties() -
getValues
Returns the opaque PropertyValue objects. This can be useful when you want to avoid the strict type checking of the value, and it's important to note that if the property is bound, the value will be a BoundValue. Be very careful about overriding, and make sure to maintain the methodology of using getProperties to iterate and get (or getOrDefault), to get the value, because those are all handled differently by BoundPropertySets, ExtendedPropertySets, etc. -
get
Retrieves the value of the property, or null if this set doesn't contain that property. -
contains
- Returns:
- True if the source contains a value for prop.
-
getOrDefault
- Returns:
- The value for prop or
Property.getDefaultValue()
if not present. Can return null if the value is null.
-
getOrElse
Get the value for a givenProperty
, or else fall back to value if it's not present.- Parameters:
prop
- TheProperty
for which a value is to be retrieved.value
- The value to default to if property isn't present.- Returns:
- The value of property if present, value if not. Can return null if the value is null.
-
getNonNull
The value for prop if it exists and is not null. Otherwise returnsProperty.getDefaultValue()
if that exists and is not null. Finally will fallback to value.- Parameters:
prop
- TheProperty
for which a value is to be retrieved.value
- The value to default to if property isn't present or returns null and has no default.- Returns:
- The value of property if present and non-null, otherwise
Property.getDefaultValue()
if non-null, otherwise value if neither is present and non-null
-
getNonNull
The value for prop if it exists and is not null. Otherwise returnsProperty.getDefaultValue()
if that exists and is not null. Finally will fallback to value.- Parameters:
prop
- TheProperty
for which a value is to be retrieved.supplier
- The supplier of a default value to use if property isn't present or returns null and has no default. Supplier must not return null.- Returns:
- The value of property if present and non-null, otherwise
Property.getDefaultValue()
if non-null, otherwise value if neither is present and non-null
-