Interface PropertyValueSource
-
- All Known Subinterfaces:
AlarmDefinition
,AlarmEvent
,AuthenticatedUser
,BoundPropertySet
,MutablePropertyValueSource
,NotificationContext
,ObservablePropertySet
,ObservablePropertySource
,PropertySet
,PropertySetEdit
,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
,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 asPropertySet
), used to retrieve property values.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
contains(Property<?> prop)
<T> T
get(Property<T> prop)
Retrieves the value of the property, or null if this set doesn't contain that property.default <T> T
getNonNull(Property<T> prop, java.util.function.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.<T> T
getOrDefault(Property<T> prop)
<T> T
getOrElse(Property<T> prop, T value)
Get the value for a givenProperty
, or else fall back to value if it's not present.java.util.Collection<Property<?>>
getProperties()
default java.util.List<PropertyValue>
getValues()
Returns the opaque PropertyValue objects.
-
-
-
Method Detail
-
getProperties
java.util.Collection<Property<?>> getProperties()
-
getValues
default java.util.List<PropertyValue> 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
@Nullable <T> T get(Property<T> prop)
Retrieves the value of the property, or null if this set doesn't contain that property.
-
contains
boolean contains(Property<?> prop)
- Returns:
- True if the source contains a value for prop.
-
getOrDefault
@Nullable <T> T getOrDefault(Property<T> prop)
- Returns:
- The value for prop or
Property.getDefaultValue()
if not present. Can return null if the value is null.
-
getOrElse
@Nullable <T> T getOrElse(Property<T> prop, T value)
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
@Nonnull default <T> T getNonNull(Property<T> prop, @Nonnull T value)
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
@Nonnull default <T> T getNonNull(Property<T> prop, @Nonnull java.util.function.Supplier<T> supplier)
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
-
-