restx.security.DefaultSessionDefinitionEntry Maven / Gradle / Ivy
package restx.security;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import restx.security.RestxSession.Definition.Entry;
/**
* Date: 20/1/15
* Time: 20:56
*/
public class DefaultSessionDefinitionEntry implements Entry {
private final String sessionDefKey;
private final Function> function;
public DefaultSessionDefinitionEntry(Class clazz, String sessionDefKey, Function> function) {
this.sessionDefKey = sessionDefKey;
this.function = function;
}
@Override
public String getKey() {
return sessionDefKey;
}
@Override
public Optional extends T> getValueForId(String valueId) {
return function.apply(valueId);
}
}