01: package org.apache.velocity.util.introspection;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "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: import java.util.Iterator;
23:
24: /**
25: * 'Federated' introspection/reflection interface to allow the introspection
26: * behavior in Velocity to be customized.
27: *
28: * @author <a href="mailto:geirm@apache.org">Geir Magusson Jr.</a>
29: * @version $Id: Uberspect.java 463298 2006-10-12 16:10:32Z henning $
30: */
31: public interface Uberspect {
32: /**
33: * Initializer - will be called before use
34: * @throws Exception
35: */
36: public void init() throws Exception;
37:
38: /**
39: * To support iteratives - #foreach()
40: * @param obj
41: * @param info
42: * @return An Iterator.
43: * @throws Exception
44: */
45: public Iterator getIterator(Object obj, Info info) throws Exception;
46:
47: /**
48: * Returns a general method, corresponding to $foo.bar( $woogie )
49: * @param obj
50: * @param method
51: * @param args
52: * @param info
53: * @return A Velocity Method.
54: * @throws Exception
55: */
56: public VelMethod getMethod(Object obj, String method,
57: Object[] args, Info info) throws Exception;
58:
59: /**
60: * Property getter - returns VelPropertyGet appropos for #set($foo = $bar.woogie)
61: * @param obj
62: * @param identifier
63: * @param info
64: * @return A Velocity Getter.
65: * @throws Exception
66: */
67: public VelPropertyGet getPropertyGet(Object obj, String identifier,
68: Info info) throws Exception;
69:
70: /**
71: * Property setter - returns VelPropertySet appropos for #set($foo.bar = "geir")
72: * @param obj
73: * @param identifier
74: * @param arg
75: * @param info
76: * @return A Velocity Setter.
77: * @throws Exception
78: */
79: public VelPropertySet getPropertySet(Object obj, String identifier,
80: Object arg, Info info) throws Exception;
81: }
|