T
- The type of the Model Objectpublic abstract class LambdaModel<T> extends Object implements IModel<T>
LambdaModel
is a basic implementation of an IModel
that uses a
serializable Supplier
to get the object and
Consumer
to set it.Modifier and Type | Method and Description |
---|---|
static <X,R> IModel<R> |
of(IModel<X> target,
org.danekja.java.util.function.serializable.SerializableFunction<X,R> getter)
Deprecated.
this method will be remove in Wicket 9.x, use
IModel.map(SerializableFunction) instead. |
static <X,R> IModel<R> |
of(IModel<X> target,
org.danekja.java.util.function.serializable.SerializableFunction<X,R> getter,
org.danekja.java.util.function.serializable.SerializableBiConsumer<X,R> setter)
Create a
LambdaModel for a given target. |
static <R> IModel<R> |
of(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter)
Create a read-only
IModel . |
static <R> IModel<R> |
of(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter,
org.danekja.java.util.function.serializable.SerializableConsumer<R> setter)
Create a
LambdaModel . |
void |
setObject(T t)
Sets the model object.
|
public void setObject(T t)
IModel
public static <R> IModel<R> of(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter)
IModel
. Usage:
LambdaModel.of(person::getName)
Note that IModel
is a FunctionalInterface
and you can also use a lambda
directly as a model.R
- model object typegetter
- used to get valuepublic static <R> IModel<R> of(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter, org.danekja.java.util.function.serializable.SerializableConsumer<R> setter)
LambdaModel
. Usage:
LambdaModel.of(person::getName, person::setName)
R
- model object typegetter
- used to get valuesetter
- used to set value@Deprecated public static <X,R> IModel<R> of(IModel<X> target, org.danekja.java.util.function.serializable.SerializableFunction<X,R> getter)
IModel.map(SerializableFunction)
instead.LambdaModel
for a given target. Usage:
LambdaModel.of(personModel, Person::getName)
The target model will be detached automatically.X
- target model object typeR
- model object typetarget
- target for getter and settergetter
- used to get a valuepublic static <X,R> IModel<R> of(IModel<X> target, org.danekja.java.util.function.serializable.SerializableFunction<X,R> getter, org.danekja.java.util.function.serializable.SerializableBiConsumer<X,R> setter)
LambdaModel
for a given target. Usage:
LambdaModel.of(personModel, Person::getName, Person::setName)
The target model will be detached automatically.X
- target model object typeR
- model object typetarget
- target for getter and settergetter
- used to get a valuesetter
- used to set a valueIModel.flatMap(SerializableFunction)
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.