View Javadoc

1   /*
2    * Copyright 2004-2005 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.morph.reflect;
17  
18  import net.sf.composite.Component;
19  import net.sf.morph.wrap.Wrapper;
20  
21  /**
22   * A reflector exposes the information contained within another object. There
23   * are two main types of reflectors: {@link net.sf.morph.reflect.BeanReflector}s
24   * and {@link net.sf.morph.reflect.ContainerReflector}s.
25   * 
26   * @author Matt Sgarlata
27   * @since Nov 14, 2004
28   */
29  public interface Reflector extends Component {
30  
31  	/**
32  	 * Defines which classes are reflectable by this reflector. Each returned
33  	 * class and all its subclasses are reflectable by this reflector.
34  	 * 
35  	 * @return the classes that are reflectable by this reflector.
36  	 */
37  	public Class[] getReflectableClasses();
38  	
39  	/**
40  	 * Optional operation: returns a wrapper for the given object.
41  	 * 
42  	 * @param object
43  	 *            the object for which a wrapper is desired
44  	 * @return the wrapper
45  	 * @throws UnsupportedOperationException
46  	 *             if the reflector does not support retrieving wrappers
47  	 */
48  	public Wrapper getWrapper(Object object);
49  }