org.wicketstuff.lambda.model.SupplierModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wicketstuff-lambda Show documentation
Show all versions of wicketstuff-lambda Show documentation
WicketStuff Lambda is a collection of Java 8 functionality.
The newest version!
package org.wicketstuff.lambda.model;
import org.apache.wicket.model.LoadableDetachableModel;
import org.wicketstuff.lambda.SerializableSupplier;
/**
* {@link LoadableDetachableModel} that gets its value from a {@link SerializableSupplier}.
*
* @param
* - type of the model object
* @deprecated Use {@link LambdaModel} or {@link LoadableDetachableModel#of(org.danekja.java.util.function.serializable.SerializableSupplier)} instead
*/
public class SupplierModel extends LoadableDetachableModel {
private static final long serialVersionUID = 1L;
/*
* Supplier that supplies the value of the model.
*/
private SerializableSupplier supplier;
/**
* Constructor.
* @param supplier that supplies the value of the model
*/
public SupplierModel(SerializableSupplier supplier) {
this.supplier = supplier;
}
@Override
protected T load() {
return supplier.get();
}
}