View Javadoc
1   /*
2    * Copyright 2004-2022 the original author or authors.
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    *    https://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 com.ibatis.common.beans;
17  
18  /**
19   * A Probe is an object that is used to work with beans, DOM objects, or other objects.
20   */
21  public interface Probe {
22  
23    /**
24     * Gets an Object property from another object.
25     *
26     * @param object
27     *          - the object
28     * @param name
29     *          - the property name
30     *
31     * @return The property value (as an Object)
32     */
33    public Object getObject(Object object, String name);
34  
35    /**
36     * Sets the value of a property on an object.
37     *
38     * @param object
39     *          - the object to change
40     * @param name
41     *          - the name of the property to set
42     * @param value
43     *          - the new value to set
44     */
45    public void setObject(Object object, String name, Object value);
46  
47    /**
48     * Returns the class that the setter expects when setting a property.
49     *
50     * @param object
51     *          - the object to check
52     * @param name
53     *          - the name of the property
54     *
55     * @return The type of the property
56     */
57    public Class getPropertyTypeForSetter(Object object, String name);
58  
59    /**
60     * Returns the class that the getter will return when reading a property.
61     *
62     * @param object
63     *          - the object to check
64     * @param name
65     *          - the name of the property
66     *
67     * @return The type of the property
68     */
69    public Class getPropertyTypeForGetter(Object object, String name);
70  
71    /**
72     * Checks to see if an object has a writable property by a given name.
73     *
74     * @param object
75     *          - the object to check
76     * @param propertyName
77     *          - the property to check for
78     *
79     * @return True if the property exists and is writable
80     */
81    public boolean hasWritableProperty(Object object, String propertyName);
82  
83    /**
84     * Checks to see if an object has a readable property by a given name.
85     *
86     * @param object
87     *          - the object to check
88     * @param propertyName
89     *          - the property to check for
90     *
91     * @return True if the property exists and is readable
92     */
93    public boolean hasReadableProperty(Object object, String propertyName);
94  
95  }