View Javadoc

1   package org.apache.velocity.util.introspection;
2   
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  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      /**
34       *  Initializer - will be called before use
35       * @throws Exception
36       */
37      public void init() throws Exception;
38  
39      /**
40       *  To support iteratives - #foreach()
41       * @param obj
42       * @param info
43       * @return An Iterator.
44       * @throws Exception
45       */
46      public Iterator getIterator(Object obj, Info info) throws Exception;
47  
48      /**
49       *  Returns a general method, corresponding to $foo.bar( $woogie )
50       * @param obj
51       * @param method
52       * @param args
53       * @param info
54       * @return A Velocity Method.
55       * @throws Exception
56       */
57      public VelMethod getMethod(Object obj, String method, 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, Info info) throws Exception;
68  
69      /**
70       * Property setter - returns VelPropertySet appropos for #set($foo.bar = "geir")
71       * @param obj
72       * @param identifier
73       * @param arg
74       * @param info
75       * @return A Velocity Setter.
76       * @throws Exception
77       */
78      public VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info info) throws Exception;
79  }