T
- Model object.@FunctionalInterface public interface IModel<T> extends IDetachable
Model
.
IDetachable.detach()
, so that
interface implementers can detach transient information when a model is no longer being actively
used by the framework. This reduces memory use and reduces the expense of replicating the model
in a clustered server environment. To implement a detachable model, you should generally extend
LoadableDetachableModel
instead of implementing IModel directly.
getObject()
method
is called, the value returned will depend on the Component which is asking for the value.
Likewise, the setObject(Object)
method sets a different property depending on which
Component is doing the setting. For more information on CompoundPropertyModels and model
inheritance, see CompoundPropertyModel
and
Page
.
Component.sameInnermostModel(org.apache.wicket.Component)
,
Component.sameInnermostModel(IModel)
Modifier and Type | Method and Description |
---|---|
default void |
detach()
Detaches model after use.
|
default IModel<T> |
filter(WicketFunction<? super T,Boolean> predicate)
Returns a IModel checking whether the predicate holds for the contained object, if it is not
null.
|
default <R> IModel<R> |
flatMap(WicketFunction<? super T,IModel<R>> mapper)
Returns a IModel applying the given mapper to the contained object, if it is not NULL.
|
T |
getObject()
Gets the model object.
|
default <R> IModel<R> |
map(WicketFunction<? super T,R> mapper)
Returns a IModel applying the given mapper to the contained object, if it is not
null . |
default <R,U> IModel<R> |
mapWith(WicketBiFunction<? super T,? super U,R> combiner,
IModel<U> other)
Returns a IModel applying the given combining function to the contained object of this and
the given other model, if they are not null.
|
static <T> IModel<T> |
of(IModel<?> model)
Supresses generics warning when casting model types.
|
default IModel<T> |
orElse(T other)
Returns a IModel, returning either the contained object or the given default value, depending
on the
null ness of the contained object. |
default IModel<T> |
orElseGet(WicketSupplier<? extends T> other)
Returns a IModel, returning either the contained object or invoking the given supplier to get
a default value.
|
default void |
setObject(T object)
Sets the model object.
|
T getObject()
default void setObject(T object)
object
- The model objectUnsupportedOperationException
- unless overriddendefault void detach()
IDetachable
detach
in interface IDetachable
default IModel<T> filter(WicketFunction<? super T,Boolean> predicate)
predicate
- a predicate to be used for testing the contained objectdefault <R> IModel<R> map(WicketFunction<? super T,R> mapper)
null
.R
- the new type of the contained objectmapper
- a mapper, to be applied to the contained objectdefault <R,U> IModel<R> mapWith(WicketBiFunction<? super T,? super U,R> combiner, IModel<U> other)
R
- the resulting typeU
- the other models typecombiner
- a function combining this and the others object to a result.other
- another model to be combined with this onedefault <R> IModel<R> flatMap(WicketFunction<? super T,IModel<R>> mapper)
R
- the new type of the contained objectmapper
- a mapper, to be applied to the contained objectdefault IModel<T> orElse(T other)
null
ness of the contained object.other
- a default valuedefault IModel<T> orElseGet(WicketSupplier<? extends T> other)
other
- a supplier to be used as a defaultCopyright © 2006–2016 Apache Software Foundation. All rights reserved.