/*
* 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.
*/
/**
* An IndexedPropertyDescriptor describes a property that acts like an
* specific elements of the array.
* <p>
* An indexed property may also provide simple non-indexed read and write
* methods. If these are present, they read and write arrays of the type
* returned by the indexed read method.
*/
/**
* This constructor constructs an IndexedPropertyDescriptor for a property
* that follows the standard Java conventions by having getFoo and setFoo
* accessor methods, for both indexed access and array access.
* <p>
* Thus if the argument name is "fred", it will assume that there
* is an indexed reader method "getFred", a non-indexed (array) reader
* method also called "getFred", an indexed writer method "setFred",
* and finally a non-indexed writer method "setFred".
*
* @param propertyName The programmatic name of the property.
* @param beanClass The Class object for the target bean.
* @exception IntrospectionException if an exception occurs during
* introspection.
*/
throws IntrospectionException {
this(propertyName, beanClass,
}
/**
* This constructor takes the name of a simple property, and method
* names for reading and writing the property, both indexed
* and non-indexed.
*
* @param propertyName The programmatic name of the property.
* @param beanClass The Class object for the target bean.
* @param readMethodName The name of the method used for reading the property
* values as an array. May be null if the property is write-only
* or must be indexed.
* @param writeMethodName The name of the method used for writing the property
* values as an array. May be null if the property is read-only
* or must be indexed.
* @param indexedReadMethodName The name of the method used for reading
* an indexed property value.
* May be null if the property is write-only.
* @param indexedWriteMethodName The name of the method used for writing
* an indexed property value.
* May be null if the property is read-only.
* @exception IntrospectionException if an exception occurs during
* introspection.
*/
throws IntrospectionException {
}
}
// Implemented only for type checking.
}
/**
* This constructor takes the name of a simple property, and Method
* objects for reading and writing the property.
*
* @param propertyName The programmatic name of the property.
* @param readMethod The method used for reading the property values as an array.
* May be null if the property is write-only or must be indexed.
* @param writeMethod The method used for writing the property values as an array.
* May be null if the property is read-only or must be indexed.
* @param indexedReadMethod The method used for reading an indexed property value.
* May be null if the property is write-only.
* @param indexedWriteMethod The method used for writing an indexed property value.
* May be null if the property is read-only.
* @exception IntrospectionException if an exception occurs during
* introspection.
*/
throws IntrospectionException {
// Type checking
}
/**
* Creates <code>PropertyDescriptor</code> for the specified bean
*
* @param bean the type of the target bean
* @param base the base name of the property (the rest of the method name)
* @param read the method used for reading the property value
* @param write the method used for writing the property value
* @param readIndexed the method used for reading an indexed property value
* @param writeIndexed the method used for writing an indexed property value
* @exception IntrospectionException if an exception occurs during introspection
*
* @since 1.7
*/
IndexedPropertyDescriptor(Class<?> bean, String base, Method read, Method write, Method readIndexed, Method writeIndexed) throws IntrospectionException {
// Type checking
}
/**
* Gets the method that should be used to read an indexed
* property value.
*
* @return The method that should be used to read an indexed
* property value.
* May return null if the property isn't indexed or is write-only.
*/
if (indexedReadMethod == null) {
// the Indexed readMethod was explicitly set to null.
return null;
}
if (indexedReadMethodName == null) {
} else {
}
}
// no "is" method, so look for a "get" method.
}
}
return indexedReadMethod;
}
/**
* Sets the method that should be used to read an indexed property value.
*
* @param readMethod The new indexed read method.
*/
throws IntrospectionException {
// the indexed property type is set by the reader.
}
if (readMethod == null) {
return;
}
}
/**
* Gets the method that should be used to write an indexed property value.
*
* @return The method that should be used to write an indexed
* property value.
* May return null if the property isn't indexed or is read-only.
*/
if (indexedWriteMethod == null) {
// the Indexed writeMethod was explicitly set to null.
return null;
}
// We need the indexed type to ensure that we get the correct method.
// Cannot use the getIndexedPropertyType method since that could
// result in an infinite loop.
try {
} catch (IntrospectionException ex) {
// Set iprop type to be the classic type
}
}
}
if (indexedWriteMethodName == null) {
}
if (indexedWriteMethod != null) {
}
}
}
return indexedWriteMethod;
}
/**
* Sets the method that should be used to write an indexed property value.
*
* @param writeMethod The new indexed write method.
*/
throws IntrospectionException {
// If the indexed property type has not been set, then set it.
}
if (writeMethod == null) {
return;
}
}
/**
* Returns the Java type info for the indexed property.
* Note that the {@code Class} object may describe
* primitive Java types such as {@code int}.
* This type is returned by the indexed read method
* or is used as the parameter type of the indexed write method.
*
* @return the {@code Class} object that represents the Java type info,
* or {@code null} if the type cannot be determined
*/
try {
} catch (IntrospectionException ex) {
// fall
}
}
return type;
}
}
return (this.indexedPropertyTypeRef != null)
? this.indexedPropertyTypeRef.get()
: null;
}
return (this.indexedReadMethodRef != null)
? this.indexedReadMethodRef.get()
: null;
}
return (this.indexedWriteMethodRef != null)
? this.indexedWriteMethodRef.get()
: null;
}
throws IntrospectionException {
if (indexedReadMethod != null) {
throw new IntrospectionException("bad indexed read method arg count");
}
throw new IntrospectionException("non int index to indexed read method");
}
throw new IntrospectionException("indexed read method returns void");
}
}
if (indexedWriteMethod != null) {
throw new IntrospectionException("bad indexed write method arg count");
}
throw new IntrospectionException("non int index to indexed write method");
}
throw new IntrospectionException(
"type mismatch between indexed read and indexed write methods: "
+ getName());
}
}
throw new IntrospectionException("type mismatch between indexed and non-indexed methods: "
+ getName());
}
return indexedPropertyType;
}
/**
* Compares this <code>PropertyDescriptor</code> against the specified object.
* Returns true if the objects are the same. Two <code>PropertyDescriptor</code>s
* are the same if the read, write, property types, property editor and
* flags are equivalent.
*
* @since 1.4
*/
// Note: This would be identical to PropertyDescriptor but they don't
// share the same fields.
if (this == obj) {
return true;
}
return false;
}
return false;
}
return false;
}
}
return false;
}
/**
* Package-private constructor.
* Merge two property descriptors. Where they conflict, give the
* second argument (y) priority over the first argumnnt (x).
*
* @param x The first (lower priority) PropertyDescriptor
* @param y The second (higher priority) PropertyDescriptor
*/
super(x,y);
if (x instanceof IndexedPropertyDescriptor) {
try {
}
}
} catch (IntrospectionException ex) {
// Should not happen
throw new AssertionError(ex);
}
}
if (y instanceof IndexedPropertyDescriptor) {
try {
}
}
} catch (IntrospectionException ex) {
// Should not happen
throw new AssertionError(ex);
}
}
}
/*
* Package-private dup constructor
* This must isolate the new object from any changes to the old object.
*/
super(old);
}
super.updateGenericsFor(type);
try {
}
catch (IntrospectionException exception) {
}
}
/**
* Returns a hash code value for the object.
* See {@link java.lang.Object#hashCode} for a complete description.
*
* @return a hash code value for this object.
* @since 1.5
*/
public int hashCode() {
return result;
}
}
}