All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wicketstuff.lambda.model.SupplierModel Maven / Gradle / Ivy

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();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy