/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Generated By:JJTree: Do not edit this line. AstPropertySuffix.java */
package org.jboss.el.parser;
import javax.el.ELException;
import javax.el.ELResolver;
import javax.el.MethodInfo;
import javax.el.PropertyNotFoundException;
import org.jboss.el.lang.EvaluationContext;
import org.jboss.el.util.MessageFactory;
import org.jboss.el.util.ReflectionUtil;
@SuppressWarnings("rawtypes")
public final class AstPropertySuffix extends ValueSuffixNode {
public AstPropertySuffix(int id) {
super(id);
}
public MethodInfo getMethodInfo(Object base, EvaluationContext ctx,
Class[] paramTypes) throws ELException {
return ReflectionUtil.getMethodInfo(base, this.image, paramTypes);
}
public Class getType(Object base, EvaluationContext ctx) throws ELException {
ELResolver resolver = ctx.getELResolver();
ctx.setPropertyResolved(false);
return resolver.getType(ctx, base, this.image);
}
public Object getTarget(Object base, EvaluationContext ctx)
throws ELException {
if (base == null) return null;
ELResolver resolver = ctx.getELResolver();
ctx.setPropertyResolved(false);
Object r = resolver.getValue(ctx, base, this.image);
if (r == null) {
throw new PropertyNotFoundException(MessageFactory.get(
"error.unreachable.property", base.getClass().getName(),
this.image));
}
return r;
}
public Object getValue(Object base, EvaluationContext ctx)
throws ELException {
if (base == null)
return null;
ELResolver resolver = ctx.getELResolver();
ctx.setPropertyResolved(false);
return resolver.getValue(ctx, base, this.image);
}
public Object invoke(Object base, EvaluationContext ctx,
Class[] paramTypes, Object[] paramValues) throws ELException {
return ReflectionUtil.invokeMethod(base, this.image, paramTypes,
paramValues);
}
public boolean isReadOnly(Object base, EvaluationContext ctx)
throws ELException {
ELResolver resolver = ctx.getELResolver();
ctx.setPropertyResolved(false);
return resolver.isReadOnly(ctx, base, this.image);
}
public void setValue(Object base, EvaluationContext ctx, Object value)
throws ELException {
ELResolver resolver = ctx.getELResolver();
ctx.setPropertyResolved(false);
resolver.setValue(ctx, base, this.image, value);
}
}