1/*2 * $Id: AbstractAttributeEvaluator.java 788032 2009-06-24 14:08:32Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.evaluator;
2223import org.apache.tiles.Attribute;
24import org.apache.tiles.Expression;
25import org.apache.tiles.context.TilesRequestContext;
2627/***28 * Abstract class to link a correct evaluation of an attribute, by evaluating29 * {@link Attribute#getValue()} and then {@link Attribute#getExpressionObject()}.30 *31 * @version $Rev: 788032 $ $Date: 2009-06-24 16:08:32 +0200 (mer, 24 giu 2009) $32 * @since 2.1.233 */34publicabstractclassAbstractAttributeEvaluator implements AttributeEvaluator {
3536/*** {@inheritDoc} */37public Object evaluate(Attribute attribute, TilesRequestContext request) {
38if (attribute == null) {
39thrownew IllegalArgumentException("The attribute cannot be null");
40 }
4142 Object retValue = attribute.getValue();
4344if (retValue == null) {
45 Expression expression = attribute.getExpressionObject();
46if (expression != null) {
47 retValue = evaluate(attribute.getExpressionObject()
48 .getExpression(), request);
49 }
50 }
5152return retValue;
53 }
54 }