com.g2forge.alexandria.generic.environment.implementations.ConstantEnvReference Maven / Gradle / Ivy
package com.g2forge.alexandria.generic.environment.implementations;
import com.g2forge.alexandria.generic.environment.IEnvReference;
import com.g2forge.alexandria.generic.environment.IEnvironment;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class ConstantEnvReference implements IEnvReference {
public static ConstantEnvReference create(final T value) {
return new ConstantEnvReference<>(value);
}
protected final T value;
@SuppressWarnings("unchecked")
@Override
public IEnvReference bind(final E environment) {
return (IEnvReference) this;
}
@Override
public T eval(final E context) {
return value;
}
}