FileDocCategorySizeDatePackage
FieldDescriptor.javaAPI DocGlassfish v2 API4525Fri May 04 22:31:22 BST 2007None

FieldDescriptor

public class FieldDescriptor extends Descriptor
I represent a field on an ejb. Either an actual field (e.g. for EJB1.1 CMP) or a virtual field (e.g. for EJb2.0 CMP)
author
Danny Coward

Fields Summary
Constructors Summary
public FieldDescriptor()
Constructrs an empty field descriptor

    
public FieldDescriptor(String name)
Constructrs a field descriptor with the given name.

	super(name, "no description");
    
public FieldDescriptor(String name, String description)
Constructrs a field descriptor with the given name and description.

	super(name, description);
    
public FieldDescriptor(Field field)
Constructs a field descriptor from the supplied java.lang.reflect.Field object.

	this(field.getName(), "no description");
    
Methods Summary
public static voidcheckFieldName(java.lang.String fieldName)

Check if a field name is of an acceptable value (start with a lowercase letter)

param
fieldName is the field name to test
throw
IllegalArgumentException if the name is unacceptable

        
        if (fieldName == null || fieldName.length()==0) {
            throw new IllegalArgumentException("cmp-field or cmr-field name cannot be empty strings");
        }
        char firstChar = fieldName.charAt(0);
        if (!Character.isLetter(firstChar)) {
            throw new IllegalArgumentException("cmp-field or cmr-field name " + fieldName + " must begin with a letter ");
        }
        if (!Character.isLowerCase(firstChar)) {
            throw new IllegalArgumentException("cmp-field or cmr-field name " + fieldName + " must begin with a lowercase letter");
        }        
    
public booleanequals(java.lang.Object object)
Equality iff the other objects is a field descriptor with the same name.

	if (object instanceof FieldDescriptor) {
	    FieldDescriptor otherFieldDescriptor = (FieldDescriptor) object;
	    return otherFieldDescriptor.getName().equals(this.getName());
	}
	return false;
    
public inthashCode()
My hashcode.

	return this.getName().hashCode();
    
public voidprint(java.lang.StringBuffer toStringBuffer)
Returns a formatted version of me as a String.

	toStringBuffer.append("Field: ").append(super.getName()).append("@").append(super.getDescription());