org.zodiac.template.velocity.platform.PlatformVelocityContext Maven / Gradle / Ivy
The newest version!
package org.zodiac.template.velocity.platform;
import java.util.Map;
import java.util.Objects;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.context.Context;
import org.zodiac.sdk.toolkit.util.collection.CollUtil;
public class PlatformVelocityContext extends VelocityContext {
private static final long serialVersionUID = 1323710964243147219L;
private Map originalContext = null;
public PlatformVelocityContext() {
this(null, null);
}
public PlatformVelocityContext(Map context) {
super(Objects.requireNonNull(context, "context"));
this.originalContext = context;
}
public PlatformVelocityContext(Map context, Context innerContext) {
super(Objects.requireNonNull(context, "context"), innerContext);
this.originalContext = context;
}
public Map getContext() {
return CollUtil.map(originalContext);
}
public Map getImmutableContext() {
return CollUtil.unmodifiableMap(getContext());
}
}