org.progeeks.util.beans
Class ContainerPropertyDescriptor

java.lang.Object
  extended by java.beans.FeatureDescriptor
      extended by java.beans.PropertyDescriptor
          extended by org.progeeks.util.beans.ContainerPropertyDescriptor

public class ContainerPropertyDescriptor
extends java.beans.PropertyDescriptor

Subclass of the java.beans.PropertyDescriptor class that provides additional information about multi-valued properties.

Version:
$Revision: 1.8 $
Author:
Paul Speed

Nested Class Summary
protected static class ContainerPropertyDescriptor.PluralPattern
          Encapsulates the conversion from a specific plural type to a specific singular type using a regex expression and a suffix.
 
Constructor Summary
ContainerPropertyDescriptor(java.lang.Class beanClass, java.beans.PropertyDescriptor desc)
           
 
Method Summary
 java.lang.reflect.Method getAddMethod()
          Returns the method that should be used when adding values.
 java.lang.Class getElementClass()
          Uses simple heuristics to attempt to introspect the lists element type.
 java.lang.reflect.Method getInsertMethod()
          Returns the method that should be used when inserting values.
 java.lang.reflect.Method getRemoveIndexedMethod()
          Returns the method that should be used when removing values by index.
 java.lang.reflect.Method getRemoveMethod()
          Returns the method that should be used when removing values.
 java.lang.reflect.Method getReplaceIndexMethod()
          Returns the method that should be used when replacing values by index.
 java.lang.String getSingularPropertyName()
          Returns the singular version of the property name that was used during element type detection, or null if detection bypassed this step.
 boolean isArray()
          Returns true if this property value is actually an array.
static boolean isContainerType(java.lang.Class type)
          Returns true if the specified class represents a type that can be handled as a ListPropertyType.
 boolean isList()
          Returns true if this property value is a list-based implementation.
static boolean isListType(java.lang.Class type)
          Returns true if the specified class represents a type that can be handled as a ListPropertyType.
 boolean isMutable()
          Returns true if the elements can be replaced.
 boolean isResizable()
          Returns true if the property supports resizing such as with add or remove.
protected  boolean isSingularForm(java.lang.String plural, java.lang.String name)
          Returns true if the specified name is a possible singular form of the plural property name.
protected  void setupContainerInfo()
          Attempts to configure the container info values based on some introspection heuristics and guesswork.
 
Methods inherited from class java.beans.PropertyDescriptor
createPropertyEditor, equals, getPropertyEditorClass, getPropertyType, getReadMethod, getWriteMethod, hashCode, isBound, isConstrained, setBound, setConstrained, setPropertyEditorClass, setReadMethod, setWriteMethod
 
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainerPropertyDescriptor

public ContainerPropertyDescriptor(java.lang.Class beanClass,
                                   java.beans.PropertyDescriptor desc)
                            throws java.beans.IntrospectionException
Throws:
java.beans.IntrospectionException
Method Detail

isContainerType

public static boolean isContainerType(java.lang.Class type)
Returns true if the specified class represents a type that can be handled as a ListPropertyType.


isListType

public static boolean isListType(java.lang.Class type)
Returns true if the specified class represents a type that can be handled as a ListPropertyType.


isList

public boolean isList()
Returns true if this property value is a list-based implementation.


isArray

public boolean isArray()
Returns true if this property value is actually an array.


isResizable

public boolean isResizable()
Returns true if the property supports resizing such as with add or remove.


isMutable

public boolean isMutable()
Returns true if the elements can be replaced.


getAddMethod

public java.lang.reflect.Method getAddMethod()
Returns the method that should be used when adding values.


getInsertMethod

public java.lang.reflect.Method getInsertMethod()
Returns the method that should be used when inserting values. This should generally only be valid for list-based types.


getReplaceIndexMethod

public java.lang.reflect.Method getReplaceIndexMethod()
Returns the method that should be used when replacing values by index. This should generally only be valid for list-based types and corresponds to a setFoo( int index, Object value ) or setFoo( Object value, int index ) style method.


getRemoveMethod

public java.lang.reflect.Method getRemoveMethod()
Returns the method that should be used when removing values.


getRemoveIndexedMethod

public java.lang.reflect.Method getRemoveIndexedMethod()
Returns the method that should be used when removing values by index. This should generally only be valid for list-based types.


getSingularPropertyName

public java.lang.String getSingularPropertyName()
Returns the singular version of the property name that was used during element type detection, or null if detection bypassed this step.


getElementClass

public java.lang.Class getElementClass()
Uses simple heuristics to attempt to introspect the lists element type.


isSingularForm

protected boolean isSingularForm(java.lang.String plural,
                                 java.lang.String name)
Returns true if the specified name is a possible singular form of the plural property name.


setupContainerInfo

protected void setupContainerInfo()
Attempts to configure the container info values based on some introspection heuristics and guesswork.



Copyright © 2002-2003 Paul Speed. All Rights Reserved.