/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. AstValue.java */ package org.apache.el.parser;
@Override publicClass<?> getType(EvaluationContext ctx) throws ELException {
Target t = getTarget(ctx);
ctx.setPropertyResolved(false); Class<?> result = ctx.getELResolver().getType(ctx, t.base, t.property); if (!ctx.isPropertyResolved()) { thrownew PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled", t.base, t.property));
} return result;
}
private Target getTarget(EvaluationContext ctx) throws ELException { // evaluate expr-a to value-a
Object base = this.children[0].getValue(ctx);
// if our base is null (we know there are more properties to evaluate) if (base == null) { thrownew PropertyNotFoundException(MessageFactory.get( "error.unreachable.base", this.children[0].getImage()));
}
// set up our start/end
Object property = null; int propCount = this.jjtGetNumChildren();
int i = 1; // Evaluate any properties or methods before our target
ELResolver resolver = ctx.getELResolver(); while (i < propCount) { if (i + 2 < propCount && this.children[i + 1] instanceof AstMethodParameters) { // Method call not at end of expression
base = resolver.invoke(ctx, base, this.children[i].getValue(ctx), null,
((AstMethodParameters) this.children[i + 1]).getParameters(ctx));
i += 2;
} elseif (i + 2 == propCount && this.children[i + 1] instanceof AstMethodParameters) { // Method call at end of expression
ctx.setPropertyResolved(false);
property = this.children[i].getValue(ctx);
i += 2;
if (property == null) { thrownew PropertyNotFoundException(MessageFactory.get( "error.unreachable.property", property));
}
} elseif (i + 1 < propCount) { // Object with property not at end of expression
property = this.children[i].getValue(ctx);
ctx.setPropertyResolved(false);
base = resolver.getValue(ctx, base, property);
i++;
} else { // Object with property at end of expression
ctx.setPropertyResolved(false);
property = this.children[i].getValue(ctx);
i++;
@Override // Interface el.parser.Node uses a raw type (and is auto-generated) public Object invoke(EvaluationContext ctx,
@SuppressWarnings("rawtypes") Class[] paramTypes,
Object[] paramValues) throws ELException {
private Object[] convertArgs(EvaluationContext ctx, Object[] src, Method m) { Class<?>[] types = m.getParameterTypes(); if (types.length == 0) { // Treated as if parameters have been provided so src is ignored return EMPTY_ARRAY;
}
if (src == null) { // Must be a varargs method with a single parameter. // Use a new array every time since the called code could modify the // contents of the array returnnew Object[1];
}
Object[] dest = new Object[paramCount];
for (int i = 0; i < paramCount - 1; i++) {
dest[i] = ELSupport.coerceToType(ctx, src[i], types[i]);
}
Class<?> result[] = newClass<?>[values.length]; for (int i = 0; i < values.length; i++) { if (values[i] == null) {
result[i] = null;
} else {
result[i] = values[i].getClass();
}
} return result;
}
/** * @since EL 2.2
*/
@Override public ValueReference getValueReference(EvaluationContext ctx) { // Check this is a reference to a base and a property if (this.children.length > 2 && this.jjtGetChild(2) instanceof AstMethodParameters) { // This is a method call returnnull;
}
Target t = getTarget(ctx); returnnew ValueReference(t.base, t.property);
}
/** * @since EL 2.2
*/
@Override publicboolean isParametersProvided() { // Assumption is that method parameters, if present, will be the last // child int len = children.length; if (len > 2) { if (this.jjtGetChild(len - 1) instanceof AstMethodParameters) { returntrue;
}
} returnfalse;
}
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.