FileDocCategorySizeDatePackage
FeatureDescriptor.javaAPI DocJava SE 5 API8613Fri Aug 26 14:56:56 BST 2005java.beans

FeatureDescriptor

public class FeatureDescriptor extends Object
The FeatureDescriptor class is the common baseclass for PropertyDescriptor, EventSetDescriptor, and MethodDescriptor, etc.

It supports some common information that can be set and retrieved for any of the introspection descriptors.

In addition it provides an extension mechanism so that arbitrary attribute/value pairs can be associated with a design feature.

Fields Summary
private Reference
classRef
private boolean
expert
private boolean
hidden
private boolean
preferred
private String
shortDescription
private String
name
private String
displayName
private Hashtable
table
Constructors Summary
public FeatureDescriptor()
Constructs a FeatureDescriptor.

    
FeatureDescriptor(FeatureDescriptor x, FeatureDescriptor y)
Package-private constructor, Merge information from two FeatureDescriptors. The merged hidden and expert flags are formed by or-ing the values. In the event of other conflicts, the second argument (y) is given priority over the first argument (x).

param
x The first (lower priority) MethodDescriptor
param
y The second (higher priority) MethodDescriptor

	expert = x.expert | y.expert;
	hidden = x.hidden | y.hidden;
	preferred = x.preferred | y.preferred;
	name = y.name;
	shortDescription = x.shortDescription;
	if (y.shortDescription != null) {
	    shortDescription = y.shortDescription;
	}
	displayName = x.displayName;
	if (y.displayName != null) {
	    displayName = y.displayName;
	}
	classRef = x.classRef;
	if (y.classRef != null) {
	    classRef = y.classRef;
	}
	addTable(x.table);
	addTable(y.table);
    
FeatureDescriptor(FeatureDescriptor old)

	expert = old.expert;
	hidden = old.hidden;
	preferred = old.preferred;
	name = old.name;
	shortDescription = old.shortDescription;
	displayName = old.displayName;
	classRef = old.classRef;

	addTable(old.table);
    
Methods Summary
private voidaddTable(java.util.Hashtable t)

	if (t == null) {
	    return;
	}
	java.util.Enumeration keys = t.keys();
	while (keys.hasMoreElements()) {
	    String key = (String)keys.nextElement();
	    Object value = t.get(key);
	    setValue(key, value);
	}
    
public java.util.EnumerationattributeNames()
Gets an enumeration of the locale-independent names of this feature.

return
An enumeration of the locale-independent names of any attributes that have been registered with setValue.

	if (table == null) {
	    table = new java.util.Hashtable();
	}
	return table.keys();
    
static java.lang.Stringcapitalize(java.lang.String s)

	return NameGenerator.capitalize(s);
    
static java.lang.ref.ReferencecreateReference(java.lang.Object obj, boolean soft)
Create a Reference wrapper for the object.

param
obj object that will be wrapped
param
soft true if a SoftReference should be created; otherwise Soft
return
a Reference or null if obj is null.

	Reference ref = null;
	if (obj != null) {
	    if (soft) {
		ref = new SoftReference(obj);
	    } else {
		ref = new WeakReference(obj);
	    }
	}
	return ref;
    
static java.lang.ref.ReferencecreateReference(java.lang.Object obj)

	return createReference(obj, false);
    
java.lang.ClassgetClass0()

	return (Class)getObject(classRef);
    
public java.lang.StringgetDisplayName()
Gets the localized display name of this feature.

return
The localized display name for the property/method/event. This defaults to the same as its programmatic name from getName.

	if (displayName == null) {
	    return getName();
	}
	return displayName;
    
public java.lang.StringgetName()
Gets the programmatic name of this feature.

return
The programmatic name of the property/method/event

	return name;
    
static java.lang.ObjectgetObject(java.lang.ref.Reference ref)
Returns an object from a Reference wrapper.

return
the Object in a wrapper or null.

	return (ref == null) ? null : (Object)ref.get();
    
public java.lang.StringgetShortDescription()
Gets the short description of this feature.

return
A localized short description associated with this property/method/event. This defaults to be the display name.

	if (shortDescription == null) {
	    return getDisplayName();
	}
	return shortDescription;
    
public java.lang.ObjectgetValue(java.lang.String attributeName)
Retrieve a named attribute with this feature.

param
attributeName The locale-independent name of the attribute
return
The value of the attribute. May be null if the attribute is unknown.

	if (table == null) {
	   return null;
	}
	return table.get(attributeName);
    
public booleanisExpert()
The "expert" flag is used to distinguish between those features that are intended for expert users from those that are intended for normal users.

return
True if this feature is intended for use by experts only.

	return expert;
    
public booleanisHidden()
The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans.

return
True if this feature should be hidden from human users.

	return hidden;
    
public booleanisPreferred()
The "preferred" flag is used to identify features that are particularly important for presenting to humans.

return
True if this feature should be preferentially shown to human users.

	return preferred;
    
voidsetClass0(java.lang.Class cls)

	classRef = createReference(cls);
    
public voidsetDisplayName(java.lang.String displayName)
Sets the localized display name of this feature.

param
displayName The localized display name for the property/method/event.

	this.displayName = displayName;
    
public voidsetExpert(boolean expert)
The "expert" flag is used to distinguish between features that are intended for expert users from those that are intended for normal users.

param
expert True if this feature is intended for use by experts only.

	this.expert = expert;
    
public voidsetHidden(boolean hidden)
The "hidden" flag is used to identify features that are intended only for tool use, and which should not be exposed to humans.

param
hidden True if this feature should be hidden from human users.

	this.hidden = hidden;
    
public voidsetName(java.lang.String name)
Sets the programmatic name of this feature.

param
name The programmatic name of the property/method/event

	this.name = name;
    
public voidsetPreferred(boolean preferred)
The "preferred" flag is used to identify features that are particularly important for presenting to humans.

param
preferred True if this feature should be preferentially shown to human users.

	this.preferred = preferred;
    
public voidsetShortDescription(java.lang.String text)
You can associate a short descriptive string with a feature. Normally these descriptive strings should be less than about 40 characters.

param
text A (localized) short description to be associated with this property/method/event.

	shortDescription = text;
    
public voidsetValue(java.lang.String attributeName, java.lang.Object value)
Associate a named attribute with this feature.

param
attributeName The locale-independent name of the attribute
param
value The value.

	if (table == null) {
	    table = new java.util.Hashtable();
	}
	table.put(attributeName, value);