java.lang.Object
org.apache.wicket.model.LambdaModel<T>
- Type Parameters:
T
- The type of the Model Object
- All Implemented Interfaces:
Serializable
,IDetachable
,IModel<T>
,IClusterable
LambdaModel
is a basic implementation of an IModel
that uses a
serializable Supplier
to get the object and
Consumer
to set it.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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 aLambdaModel
for a given target.static <R> IModel<R>
of
(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter) Create a read-onlyIModel
.static <R> IModel<R>
of
(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter, org.danekja.java.util.function.serializable.SerializableConsumer<R> setter) Create aLambdaModel
.void
Sets the model object.
-
Method Details
-
setObject
Description copied from interface:IModel
Sets the model object. -
of
public static <R> IModel<R> of(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter) Create a read-onlyIModel
. Usage:LambdaModel.of(person::getName)
IModel
is aFunctionalInterface
and you can also use a lambda directly as a model.- Type Parameters:
R
- model object type- Parameters:
getter
- used to get value- Returns:
- model
-
of
public static <R> IModel<R> of(org.danekja.java.util.function.serializable.SerializableSupplier<R> getter, org.danekja.java.util.function.serializable.SerializableConsumer<R> setter) Create aLambdaModel
. Usage:LambdaModel.of(person::getName, person::setName)
- Type Parameters:
R
- model object type- Parameters:
getter
- used to get valuesetter
- used to set value- Returns:
- model
-
of
public 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 aLambdaModel
for a given target. Usage:LambdaModel.of(personModel, Person::getName, Person::setName)
- Type Parameters:
X
- target model object typeR
- model object type- Parameters:
target
- target for getter and settergetter
- used to get a valuesetter
- used to set a value- Returns:
- model
- See Also:
-