01: /*
02: * Copyright 2004 Brian S O'Neill
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.cojen.util;
18:
19: import java.lang.reflect.Method;
20:
21: /**
22: * Contains information regarding a Bean property.
23: *
24: * @author Brian S O'Neill
25: * @see BeanIntrospector
26: */
27: public interface BeanProperty {
28: /**
29: * Returns the name of this property.
30: */
31: String getName();
32:
33: /**
34: * Returns the type of this property.
35: */
36: Class getType();
37:
38: /**
39: * Returns a no-arg method used to read the property value, or null if
40: * reading is not allowed. The return type matches the type of this
41: * property.
42: */
43: Method getReadMethod();
44:
45: /**
46: * Returns a one argument method used to write the property value, or null
47: * if writing is not allowed. The first argument is the value to set, which
48: * is the type of this property.
49: */
50: Method getWriteMethod();
51:
52: /**
53: * Returns the count of index types supported by this property.
54: */
55: int getIndexTypesCount();
56:
57: /**
58: * Returns a specific index type supported by this property.
59: */
60: Class getIndexType(int index) throws IndexOutOfBoundsException;
61:
62: /**
63: * Returns a one argument method used to read the indexed property value,
64: * or null if indexed reading is not allowed. The first argument on the
65: * returned method is the index value.
66: */
67: Method getIndexedReadMethod(int index)
68: throws IndexOutOfBoundsException;
69:
70: /**
71: * Returns a two argument method used to write the indexed property value,
72: * or null if indexed writing is not allowed. The first argument on the
73: * returned method is the index value. The second argument is the indexed
74: * value to set, which is the type of this property.
75: */
76: Method getIndexedWriteMethod(int index)
77: throws IndexOutOfBoundsException;
78:
79: String toString();
80: }
|