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 774412 2009-05-13 15:54:07Z nbubna $
30   */
31  public interface Uberspect
32  {
33      /**
34       *  Initializer - will be called before use
35       */
36      public void init();
37  
38      /**
39       *  To support iteratives - #foreach()
40       * @param obj
41       * @param info
42       * @return An Iterator.
43       */
44      public Iterator getIterator(Object obj, Info info) throws Exception;
45  
46      /**
47       *  Returns a general method, corresponding to $foo.bar( $woogie )
48       * @param obj
49       * @param method
50       * @param args
51       * @param info
52       * @return A Velocity Method.
53       */
54      public VelMethod getMethod(Object obj, String method, Object[] args, Info info) throws Exception;
55  
56      /**
57       * Property getter - returns VelPropertyGet appropos for #set($foo = $bar.woogie)
58       * @param obj
59       * @param identifier
60       * @param info
61       * @return A Velocity Getter.
62       */
63      public VelPropertyGet getPropertyGet(Object obj, String identifier, Info info) throws Exception;
64  
65      /**
66       * Property setter - returns VelPropertySet appropos for #set($foo.bar = "geir")
67       * @param obj
68       * @param identifier
69       * @param arg
70       * @param info
71       * @return A Velocity Setter.
72       */
73      public VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info info) throws Exception;
74  }