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

com.github.paganini2008.devtools.beans.streaming.Property Maven / Gradle / Ivy

package com.github.paganini2008.devtools.beans.streaming;

import java.util.function.Function;

import com.github.paganini2008.devtools.beans.BeanUtils;

/**
 * 
 * Property
 * 
 * @author Fred Feng
 * 
 * 
 * @version 1.0
 */
public final class Property implements Function {

	private final String propertyName;
	private final Class requiredType;

	Property(String propertyName, Class requiredType) {
		this.propertyName = propertyName;
		this.requiredType = requiredType;
	}

	public T apply(E e) {
		return BeanUtils.getProperty(e, propertyName, requiredType);
	}

	public static  Property forName(String propertyName, Class requiredType) {
		return new Property(propertyName, requiredType);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy