P
- Concrete type of the properties contained in the setpublic interface PropertySet<P extends Property> extends Iterable<P>, HasConfiguration<ParameterSet>
Modifier and Type | Interface and Description |
---|---|
static interface |
PropertySet.Builder<P extends Property>
Builder to create
PropertySet instances. |
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_KEY
Default
Context resource reference |
static ConfigProperty<PropertySet> |
PROPERTY_CONFIGURATION_ATTRIBUTE
The
PropertyConfiguration attribute to use to declare the PropertySet for a PropertyBox type
Property . |
Modifier and Type | Method and Description |
---|---|
default List<P> |
asList()
Convert this PropertySet into a
List of properties. |
static PropertySet.Builder<Property<?>> |
builder()
Obtain a builder to create and populate a generic
PropertySet . |
static <P extends Property> |
builder(Class<? extends P> propertyType)
Obtain a builder to create and populate a
PropertySet which supports given Property type. |
static <P extends Property> |
builderOf(P... properties)
Obtain a builder to create and populate a
PropertySet , and add given properties to the
property set to build. |
boolean |
contains(Property property)
Return
true if this set contains the given property . |
default <V> V |
execute(Callable<V> operation)
|
ParameterSet |
getConfiguration()
Get the property set configuration, which can be used for extensions and application-specific purposes.
|
default Optional<P> |
getFirstIdentifier()
Get the first property which acts as property set identifier, if available.
|
Set<P> |
getIdentifiers()
Get the optional identifier properties which represent the unique identifier of this property set.
|
default Stream<P> |
identifiers()
Get a
Stream of the properties which represent the unique identifier of this property set. |
static <P extends Property> |
join(PropertySet<? extends P>... propertySets)
Deprecated.
Using this method causes the loss of any property set configuration and/or identifier property
declaration. Use the default PropertySet builder to compose a new PropertySet from different property
sources.
|
static <P extends Property> |
of(Iterable<P> properties)
Create a new PropertySet containing all given
properties Iterable elements. |
static <P extends Property> |
of(P... properties)
Create a new PropertySet containing given
properties . |
static <P extends Property> |
of(PropertySet<? extends P> propertySet,
P... properties)
|
int |
size()
Returns the number of properties in this set.
|
Stream<P> |
stream()
Returns a sequential
Stream of the Property s of this set. |
forEach, iterator, spliterator
hasConfiguration
static final ConfigProperty<PropertySet> PROPERTY_CONFIGURATION_ATTRIBUTE
PropertyConfiguration
attribute to use to declare the PropertySet for a PropertyBox type
Property
.int size()
boolean contains(Property property)
true
if this set contains the given property
. If the given property
is null
, always returns false
.property
- Property whose presence in this set is to be testedtrue
if this set contains the specified propertyStream<P> stream()
Stream
of the Property
s of this set.Set<P> getIdentifiers()
If one or more identifier property is declared, the values of such properties uniquely specify the instance of an object bound to this property set. The identifier properties of the set can be used, for example, as a dicriminator for object equality.
default Stream<P> identifiers()
Stream
of the properties which represent the unique identifier of this property set.default Optional<P> getFirstIdentifier()
ParameterSet getConfiguration()
This configuration is considered as immutable. The configuration parameters has to setted at PropertySet
build time, using the appropriate PropertySet.Builder
methods: PropertySet.Builder.configuration(String, Object)
and
PropertySet.Builder.configuration(ConfigProperty, Object)
.
getConfiguration
in interface HasConfiguration<ParameterSet>
ParameterSet
(never null)default List<P> asList()
List
of properties.default <V> V execute(Callable<V> operation)
Callable
operation
on behalf of this PropertySet, i.e. binding this
PropertySet as Context
resource to current Thread, and removing the binding after operation execution.V
- Operation result typeoperation
- Operation to executestatic PropertySet.Builder<Property<?>> builder()
PropertySet
.PropertySet
builderstatic <P extends Property> PropertySet.Builder<P> builder(Class<? extends P> propertyType)
PropertySet
which supports given Property
type.P
- Property typepropertyType
- The property type managed by the PropertySet
to build (not null)PropertySet
builder@SafeVarargs static <P extends Property> PropertySet.Builder<Property<?>> builderOf(P... properties)
PropertySet
, and add given properties
to the
property set to build.P
- Property typeproperties
- Properties to initially add to the property set (not null)PropertySet
builder@SafeVarargs static <P extends Property> PropertySet<P> of(P... properties)
properties
.P
- Type of the property managed by the property setproperties
- Properties of the setstatic <P extends Property> PropertySet<P> of(Iterable<P> properties)
properties
Iterable
elements.P
- Type of the property managed by the property setproperties
- Properties of the set@SafeVarargs static <P extends Property> PropertySet<P> of(PropertySet<? extends P> propertySet, P... properties)
PropertySet
joining given propertySet
with given additional
properties
.
Any identifier property declared by given propertySet
will be an identifier of the new property set
too. The original property set configuration is cloned to the new PropertySet
instance configuration.
P
- Property typepropertySet
- Source property set (not null)properties
- Additional propertiesPropertySet
instance containing the properties of given propertySet
and any
additional provided property@Deprecated @SafeVarargs static <P extends Property> PropertySet<P> join(PropertySet<? extends P>... propertySets)
PropertySet
s and return a new PropertySet containing all the properties of given sets.P
- Actual property typepropertySets
- PropertySet to join (not null and not empty)Copyright © 2019 The Holon Platform. All rights reserved.