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.
Method from java.beans.FeatureDescriptor Detail: |
void appendTo(StringBuilder sb) {
}
|
static void appendTo(StringBuilder sb,
String name,
Reference reference) {
if (reference != null) {
appendTo(sb, name, reference.get());
}
}
|
static void appendTo(StringBuilder sb,
String name,
Object value) {
if (value != null) {
sb.append("; ").append(name).append("=").append(value);
}
}
|
static void appendTo(StringBuilder sb,
String name,
boolean value) {
if (value) {
sb.append("; ").append(name);
}
}
|
public Enumeration<String> attributeNames() {
return getTable().keys();
}
Gets an enumeration of the locale-independent names of this
feature. |
Class getClass0() {
return (this.classRef != null)
? this.classRef.get()
: null;
}
|
public String getDisplayName() {
if (displayName == null) {
return getName();
}
return displayName;
}
Gets the localized display name of this feature. |
public String getName() {
return name;
}
Gets the programmatic name of this feature. |
static Class[] getParameterTypes(Class base,
Method method) {
if (base == null) {
base = method.getDeclaringClass();
}
return TypeResolver.erase(TypeResolver.resolveInClass(base, method.getGenericParameterTypes()));
}
Resolves the parameter types of the method. |
static Class getReturnType(Class base,
Method method) {
if (base == null) {
base = method.getDeclaringClass();
}
return TypeResolver.erase(TypeResolver.resolveInClass(base, method.getGenericReturnType()));
}
Resolves the return type of the method. |
public String getShortDescription() {
if (shortDescription == null) {
return getDisplayName();
}
return shortDescription;
}
Gets the short description of this feature. |
static Reference<T> getSoftReference(T object) {
return (object != null)
? new SoftReference< T >(object)
: null;
}
Creates a new soft reference that refers to the given object. |
public Object getValue(String attributeName) {
return (this.table != null)
? this.table.get(attributeName)
: null;
}
Retrieve a named attribute with this feature. |
static Reference<T> getWeakReference(T object) {
return (object != null)
? new WeakReference< T >(object)
: null;
}
Creates a new weak reference that refers to the given object. |
public boolean isExpert() {
return expert;
}
The "expert" flag is used to distinguish between those features that are
intended for expert users from those that are intended for normal users. |
public boolean isHidden() {
return hidden;
}
The "hidden" flag is used to identify features that are intended only
for tool use, and which should not be exposed to humans. |
public boolean isPreferred() {
return preferred;
}
The "preferred" flag is used to identify features that are particularly
important for presenting to humans. |
boolean isTransient() {
Object value = getValue(TRANSIENT);
return (value instanceof Boolean)
? (Boolean) value
: false;
}
Indicates whether the feature is transient. |
void setClass0(Class cls) {
this.classRef = getWeakReference(cls);
}
|
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
Sets the localized display name of this feature. |
public void setExpert(boolean expert) {
this.expert = expert;
}
The "expert" flag is used to distinguish between features that are
intended for expert users from those that are intended for normal users. |
public void setHidden(boolean hidden) {
this.hidden = hidden;
}
The "hidden" flag is used to identify features that are intended only
for tool use, and which should not be exposed to humans. |
public void setName(String name) {
this.name = name;
}
Sets the programmatic name of this feature. |
public void setPreferred(boolean preferred) {
this.preferred = preferred;
}
The "preferred" flag is used to identify features that are particularly
important for presenting to humans. |
public void setShortDescription(String text) {
shortDescription = text;
}
You can associate a short descriptive string with a feature. Normally
these descriptive strings should be less than about 40 characters. |
void setTransient(Transient annotation) {
if ((annotation != null) && (null == getValue(TRANSIENT))) {
setValue(TRANSIENT, annotation.value());
}
}
Sets the "transient" attribute according to the annotation.
If the "transient" attribute is already set
it should not be changed. |
public void setValue(String attributeName,
Object value) {
getTable().put(attributeName, value);
}
Associate a named attribute with this feature. |
public String toString() {
StringBuilder sb = new StringBuilder(getClass().getName());
sb.append("[name=").append(this.name);
appendTo(sb, "displayName", this.displayName);
appendTo(sb, "shortDescription", this.shortDescription);
appendTo(sb, "preferred", this.preferred);
appendTo(sb, "hidden", this.hidden);
appendTo(sb, "expert", this.expert);
if ((this.table != null) && !this.table.isEmpty()) {
sb.append("; values={");
for (Entry< String, Object > entry : this.table.entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("; ");
}
sb.setLength(sb.length() - 2);
sb.append("}");
}
appendTo(sb);
return sb.append("]").toString();
}
Returns a string representation of the object. |