/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class is intended to handle <property> element.
* This element simplifies access to the properties.
* If the {@code index} attribute is specified
* this element uses additional {@code int} parameter.
* If the {@code name} attribute is not specified
* this element uses method "get" as getter
* and method "set" as setter.
* This element defines getter if it contains no argument.
* It returns the value of the property in this case.
* For example:<pre>
* <property name="object" index="10"/></pre>
* is shortcut to<pre>
* <method name="getObject">
* <int>10</int>
* </method></pre>
* which is equivalent to {@code getObject(10)} in Java code.
* This element defines setter if it contains one argument.
* It does not return the value of the property in this case.
* For example:<pre>
* <property><int>0</int></property></pre>
* is shortcut to<pre>
* <method name="set">
* <int>0</int>
* </method></pre>
* which is equivalent to {@code set(0)} in Java code.
* <p>The following atributes are supported:
* <dl>
* <dt>name
* <dd>the property name
* <dt>index
* <dd>the property index
* <dt>id
* <dd>the identifier of the variable that is intended to store the result
* </dl>
*
* @since 1.7
*
* @author Sergey A. Malenkov
*/
/**
* Parses attributes of the element.
* The following atributes are supported:
* <dl>
* <dt>name
* <dd>the property name
* <dt>index
* <dd>the property index
* <dt>id
* <dd>the identifier of the variable that is intended to store the result
* </dl>
*
* @param name the attribute name
* @param value the attribute value
*/
} else {
}
}
/**
* Tests whether the value of this element can be used
* as an argument of the element that contained in this one.
*
* @return {@code true} if the value of this element should be used
* as an argument of the element that contained in this one,
* {@code false} otherwise
*/
protected boolean isArgument() {
return false; // non-static accessor cannot be used an argument
}
/**
* Returns the value of the property with specified {@code name}.
*
* @param name the name of the property
* @return the value of the specified property
*/
try {
}
}
return null;
}
/**
* Sets the new value for the property with specified {@code name}.
*
* @param name the name of the property
* @param value the new value for the specified property
*/
try {
}
}
}
/**
* Performs the search of the getter for the property
* with specified {@code name} in specified class
* and returns value of the property.
*
* @param bean the context bean that contains property
* @param name the name of the property
* @param index the index of the indexed property
* @return the value of the property
* @throws IllegalAccessException if the property is not accesible
* @throws IntrospectionException if the bean introspection is failed
* @throws InvocationTargetException if the getter cannot be invoked
* @throws NoSuchMethodException if the getter is not found
*/
private static Object getPropertyValue(Object bean, String name, Integer index) throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException {
} else {
}
}
/**
* Performs the search of the setter for the property
* with specified {@code name} in specified class
* and updates value of the property.
*
* @param bean the context bean that contains property
* @param name the name of the property
* @param index the index of the indexed property
* @param value the new value for the property
* @throws IllegalAccessException if the property is not accesible
* @throws IntrospectionException if the bean introspection is failed
* @throws InvocationTargetException if the setter cannot be invoked
* @throws NoSuchMethodException if the setter is not found
*/
private static void setPropertyValue(Object bean, String name, Integer index, Object value) throws IllegalAccessException, IntrospectionException, InvocationTargetException, NoSuchMethodException {
: null;
} else {
}
}
/**
* Performs the search of the getter for the property
* with specified {@code name} in specified class.
*
* @param type the class that contains method
* @param name the name of the property
* @param args the method arguments
* @return method object that represents found getter
* @throws IntrospectionException if the bean introspection is failed
* @throws NoSuchMethodException if method is not found
*/
private static Method findGetter(Class<?> type, String name, Class<?>...args) throws IntrospectionException, NoSuchMethodException {
}
return method;
}
} else if (pd instanceof IndexedPropertyDescriptor) {
return method;
}
}
}
/**
* Performs the search of the setter for the property
* with specified {@code name} in specified class.
*
* @param type the class that contains method
* @param name the name of the property
* @param args the method arguments
* @return method object that represents found setter
* @throws IntrospectionException if the bean introspection is failed
* @throws NoSuchMethodException if method is not found
*/
private static Method findSetter(Class<?> type, String name, Class<?>...args) throws IntrospectionException, NoSuchMethodException {
}
return method;
}
} else if (pd instanceof IndexedPropertyDescriptor) {
return method;
}
}
}
/**
* Performs the search of the descriptor for the property
* with specified {@code name} in specified class.
*
* @param type the class to introspect
* @param name the property name
* @return descriptor for the named property
* @throws IntrospectionException if property descriptor is not found
*/
private static PropertyDescriptor getProperty(Class<?> type, String name) throws IntrospectionException {
return pd;
}
}
}
}