KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > extend > NamedConverter


1 /*
2  * Copyright 2005 Joe Walker
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of 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,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.directwebremoting.extend;
17
18 import java.util.Map JavaDoc;
19
20 /**
21  * Additions to Converter that allow objects to have names that
22  * @author Joe Walker [joe at getahead dot ltd dot uk]
23  */

24 public interface NamedConverter extends Converter
25 {
26     /**
27      * Get a map of property names to implementations of {@link Property}.
28      * <p>HibernateBeanConverter (and maybe others) may want to provide
29      * alternate versions of bean.getClass(), and we may wish to fake or hide
30      * properties in some cases.
31      * <p>This implementation is preferred above the alternate:
32      * {@link #getPropertyMapFromClass(Class, boolean, boolean)} because it
33      * potentially retains important extra type information.
34      * @param example The object to find bean info from
35      * @param readRequired The properties returned must be readable
36      * @param writeRequired The properties returned must be writeable
37      * @return An array of PropertyDescriptors describing the beans properties
38      * @see #getPropertyMapFromClass(Class, boolean, boolean)
39      * @throws MarshallException If the introspection fails
40      */

41     Map JavaDoc getPropertyMapFromObject(Object JavaDoc example, boolean readRequired, boolean writeRequired) throws MarshallException;
42
43     /**
44      * Get a map of property names to implementations of {@link Property}.
45      * <p>HibernateBeanConverter (and maybe others) may want to provide
46      * alternate versions of bean.getClass(), and we may wish to fake or hide
47      * properties in some cases.
48      * <p>If you have a real object to investigate then it is probably better
49      * to call {@link #getPropertyMapFromObject(Object, boolean, boolean)}
50      * because that version can take into accound extra runtime type info.
51      * @param type The class to find bean info from
52      * @param readRequired The properties returned must be readable
53      * @param writeRequired The properties returned must be writeable
54      * @return An array of PropertyDescriptors describing the beans properties
55      * @see #getPropertyMapFromObject(Object, boolean, boolean)
56      * @throws MarshallException If the introspection fails
57      */

58     Map JavaDoc getPropertyMapFromClass(Class JavaDoc type, boolean readRequired, boolean writeRequired) throws MarshallException;
59
60     /**
61      * @return Returns the instanceType.
62      */

63     Class JavaDoc getInstanceType();
64
65     /**
66      * @param instanceType The instanceType to set.
67      */

68     void setInstanceType(Class JavaDoc instanceType);
69
70     /**
71      * Accessor for the javascript class name for the converted objects.
72      * @return The Javascript name
73      */

74     String JavaDoc getJavascript();
75
76     /**
77      * Accessor for the javascript class name for the converted objects.
78      * @param javascript The Javascript name
79      */

80     void setJavascript(String JavaDoc javascript);
81 }
82
Popular Tags