public interface PropertyValuePresenterRegistry
PropertyValuePresenters bound to a condition and provide a suitable
PropertyValuePresenter.
The registry supports PropertyValuePresenters priority declaration using Priority annotation on
presenter class (where less priority value means higher priority order), to select and return the most suitable
presenter where more than one presenter matches the condition to which is bound at registration time.
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTEXT_KEY
Default
Context resource key |
| Modifier and Type | Method and Description |
|---|---|
static PropertyValuePresenterRegistry |
create(boolean loadDefaults)
Create a default instance of
PropertyValuePresenterRegistry. |
default <T> void |
forProperty(Property<? extends T> property,
PropertyValuePresenter<? super T> presenter)
Bind a
PropertyValuePresenter to the given property. |
default <T,C> void |
forPropertyConfiguration(ConfigProperty<C> configurationProperty,
C value,
PropertyValuePresenter<? super T> presenter)
Bind a
PropertyValuePresenter to the given property configuration value. |
static PropertyValuePresenterRegistry |
get()
Gets the current
PropertyValuePresenterRegistry instance. |
static PropertyValuePresenterRegistry |
getDefault()
Return the default
PropertyValuePresenterRegistry using default ClassLoader. |
static PropertyValuePresenterRegistry |
getDefault(ClassLoader classLoader)
Return the default
PropertyValuePresenterRegistry using given classLoader. |
<T> Optional<PropertyValuePresenter<T>> |
getPresenter(Property<T> property)
Gets the
PropertyValuePresenter to use with given property according to registered
presenters. |
<T> void |
register(Predicate<Property<? extends T>> condition,
PropertyValuePresenter<? super T> presenter)
|
<T> void register(Predicate<Property<? extends T>> condition, PropertyValuePresenter<? super T> presenter)
T - Property base typecondition - The condition which has to be satisfied to provide the presenter (not null)presenter - The PropertyPresenter to register (not null)default <T> void forProperty(Property<? extends T> property, PropertyValuePresenter<? super T> presenter)
PropertyValuePresenter to the given property. The presenter will be provided when the property to
render is the same as the given property.T - Property base typeproperty - The property to present (not null)presenter - The PropertyPresenter to register (not null)default <T,C> void forPropertyConfiguration(ConfigProperty<C> configurationProperty, C value, PropertyValuePresenter<? super T> presenter)
PropertyValuePresenter to the given property configuration value. The presenter will be provided
when the property has the given configurationProperty and its value equals to given
value.T - Property base typeC - Configuration property typeconfigurationProperty - The configuration property to check (not null)value - The configuration property value to check (may be null)presenter - The PropertyPresenter to register (not null)<T> Optional<PropertyValuePresenter<T>> getPresenter(Property<T> property)
PropertyValuePresenter to use with given property according to registered
presenters.T - Property base typeproperty - Property to presentstatic PropertyValuePresenterRegistry create(boolean loadDefaults)
PropertyValuePresenterRegistry.loadDefaults - true to load default PropertyValuePresenters from
META-INF/services using com.holonplatform.core.property.PropertyValuePresenter
files using default ClassLoader. Every default presenter will be registered using an always
true condition.static PropertyValuePresenterRegistry get()
PropertyValuePresenterRegistry instance.Context-bound PropertyValuePresenterRegistry instance, if available using
CONTEXT_KEY as context key, or the default instance for the default ClassLoader obtained through
getDefault().static PropertyValuePresenterRegistry getDefault(ClassLoader classLoader)
PropertyValuePresenterRegistry using given classLoader.
The default registry is inited loading PropertyValuePresenters using fully qualified name of its
implementation class name to a com.holonplatform.core.property.PropertyValuePresenter file in the
META-INF/services directory.
classLoader - ClassLoader to usestatic PropertyValuePresenterRegistry getDefault()
PropertyValuePresenterRegistry using default ClassLoader.
The default registry is inited loading PropertyValuePresenters using fully qualified name of its
implementation class name to a com.holonplatform.core.property.PropertyValuePresenter file in the
META-INF/services directory.
Copyright © 2019 The Holon Platform. All rights reserved.