de.japkit.el.juel.MapRootResolver Maven / Gradle / Ivy
package de.japkit.el.juel;
import com.google.common.base.Objects;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
import java.util.Map;
import javax.el.ELContext;
import javax.el.ELResolver;
import javax.el.PropertyNotFoundException;
/**
* Resolves root properties (base == null) from a map.
*/
@SuppressWarnings("all")
public class MapRootResolver extends ELResolver {
private Map map;
private boolean isResolvable(final Object base) {
return Objects.equal(base, null);
}
private boolean resolve(final ELContext context, final Object base, final Object property) {
context.setPropertyResolved((this.isResolvable(base) && (property instanceof String)));
return context.isPropertyResolved();
}
@Override
public Class> getCommonPropertyType(final ELContext context, final Object base) {
Class _xifexpression = null;
boolean _isResolvable = this.isResolvable(context);
if (_isResolvable) {
_xifexpression = String.class;
} else {
_xifexpression = null;
}
return _xifexpression;
}
@Override
public Iterator getFeatureDescriptors(final ELContext context, final Object base) {
return null;
}
@Override
public Class> getType(final ELContext context, final Object base, final Object property) {
Class
© 2015 - 2025 Weber Informatics LLC | Privacy Policy