1 /*
2 * $Id: AttributeResolver.java 836174 2009-11-14 13:40:31Z apetrelli $
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 package org.apache.tiles.template;
23
24 import org.apache.tiles.Attribute;
25 import org.apache.tiles.TilesContainer;
26 import org.apache.tiles.request.Request;
27
28 /**
29 * Resolves an attribute, depending on the given parameters.
30 *
31 * @version $Rev: 836174 $ $Date: 2009-11-15 00:40:31 +1100 (Sun, 15 Nov 2009) $
32 * @since 2.2.0
33 */
34 public interface AttributeResolver {
35
36 /**
37 * Computes the attribute.
38 *
39 * @param container The Tiles container to use.
40 * @param attribute The attribute to return immediately, if not null.
41 * @param name The name of the attribute.
42 * @param role A comma-separated list of roles. If present, the attribute
43 * will be rendered only if the current user belongs to one of the roles.
44 * @param ignore If <code>true</code> if the computed attribute is null, this problem will be ignored.
45 * @param defaultValue The default value of the attribute. To use only if the attribute was not computed.
46 * @param defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed.
47 * @param defaultValueType The default type of the attribute. To use only if the attribute was not computed.
48 * @param request TODO
49 * @return The computed attribute.
50 * @since 2.2.0
51 */
52 Attribute computeAttribute(TilesContainer container, Attribute attribute,
53 String name, String role, boolean ignore,
54 Object defaultValue, String defaultValueRole, String defaultValueType, Request request);
55 }