com.github.mustachejava.reflect.BaseObjectHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compiler Show documentation
Show all versions of compiler Show documentation
Implementation of mustache.js for Java
package com.github.mustachejava.reflect;
import com.github.mustachejava.Binding;
import com.github.mustachejava.Code;
import com.github.mustachejava.Iteration;
import com.github.mustachejava.ObjectHandler;
import com.github.mustachejava.TemplateContext;
import java.io.Writer;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
public abstract class BaseObjectHandler implements ObjectHandler {
@Override
public Object coerce(Object object) {
if (object instanceof Optional) {
Optional optional = (Optional) object;
if (optional.isPresent()) {
return coerce(optional.get());
} else {
return null;
}
}
return object;
}
@Override
public Writer falsey(Iteration iteration, Writer writer, Object object, List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy