FileDocCategorySizeDatePackage
FieldPropertyDescriptor.javaAPI DocApache Axis 1.44254Sat Apr 22 18:57:28 BST 2006org.apache.axis.utils

FieldPropertyDescriptor

public class FieldPropertyDescriptor extends BeanPropertyDescriptor
author
Glen Daniels (gdaniels@apache.org)

Fields Summary
private Field
field
Constructors Summary
public FieldPropertyDescriptor(String _name, Field _field)
Construct a BPD with a field Both must be set

param
_name is the name of the property
param
_field is the name of the public instance field


                                      
       
                                     
         field = _field;
         try {
             myPD = new PropertyDescriptor(_name, null, null);
         } catch (Exception e) {
             // ???
         }
         if (_field == null || _name == null) {
             throw new IllegalArgumentException(
                     Messages.getMessage(_field == null ?
                                          "badField00" : "badProp03"));
         }
     
Methods Summary
public java.lang.Objectget(java.lang.Object obj)
Get the property value

param
obj is the object
return
the entire propery value

        return field.get(obj);
    
public java.lang.Objectget(java.lang.Object obj, int i)
Get an indexed property

param
obj is the object
param
i the index
return
the object at the indicated index

        if (!isIndexed()) {
            throw new IllegalAccessException("Not an indexed property");
        }

        Object array = field.get(obj);
        return Array.get(array, i);
    
public java.lang.ClassgetActualType()

        return field.getType();
    
public java.lang.reflect.FieldgetField()

        return field;
    
public java.lang.StringgetName()

        return field.getName();
    
public java.lang.ClassgetType()
Get the type of a property

return
the type of the property

        if (isIndexed()) {
            return field.getType().getComponentType();
        } else {
            return field.getType();
        }
    
public booleanisIndexed()
Query if property is indexed. Indexed properties require valid setters/getters

return
true if indexed methods exist

        return (field.getType().getComponentType() != null);
    
public booleanisReadable()
Query if property is readable

return
true if readable

        return true;
    
public booleanisWriteable()
Query if property is writeable

return
true if writeable

        return true;
    
public voidset(java.lang.Object obj, java.lang.Object newValue)
Set the property value

param
obj is the object
param
newValue is the new value

        field.set(obj, newValue);
    
public voidset(java.lang.Object obj, int i, java.lang.Object newValue)
Set an indexed property value

param
obj is the object
param
i the index
param
newValue is the new value

        if (!isIndexed()) {
            throw new IllegalAccessException("Not an indexed field!");
        }
        Class componentType = field.getType().getComponentType();
        growArrayToSize(obj, componentType, i);
        Array.set(get(obj), i, newValue);