|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.beans.binding.ext.PropertyDelegateProvider
public abstract class PropertyDelegateProvider
PropertyDelegateProvider is responsible for providing a property
delegate. A property delegate is an Object that supplies a
named property for another class. For example, JList does not
provide an "elements" property. The following illustrates
a property delegate provider for JList's "elements"
property:
// The property delegate must be public, and it must expose the
// property it was obtained from.
public class JListProvider {
public void setElements(List<?> elements) { ... }
public List<?> getElements() { ... }
}
// The PropertyDelegateProvider must be public, and override the
// necessary methods.
public class MyPropertyDelegateProvider extends PropertyDelegateProvider {
public Object getPropertyDelegate(Object source, String property) {
return new JListProvider();
}
public Class> getPropertyDelegate(Object source, String property) {
return JListProvider.class;
}
public boolean providesDelegate(Class> type, String property) {
return (JList.class.isAssignableFrom(type) &&
"elements".equals(type));
}
};
The set of PropertyDelegateProviders are obtained using the
ServiceLoader class, see it for details on how to register a
provider.
PropertyDelegateFactory| Field Summary | |
|---|---|
static java.lang.String |
PREFERRED_BINDING_PROPERTY
Used to identify if a particular FeatureDescriptor is a
preferred property for binding. |
| Constructor Summary | |
|---|---|
PropertyDelegateProvider()
|
|
| Method Summary | |
|---|---|
abstract java.lang.Object |
createPropertyDelegate(java.lang.Object source,
java.lang.String property)
Returns the property delegate for the specified object. |
abstract java.lang.Class<?> |
getPropertyDelegateClass(java.lang.Class<?> type)
Returns the class the property delegate creates for the specified class. |
abstract boolean |
providesDelegate(java.lang.Class<?> type,
java.lang.String property)
Returns whether this PropertyDelegateProvider provides a delegate
for the Class and property pair. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PREFERRED_BINDING_PROPERTY
FeatureDescriptor is a
preferred property for binding. If a FeatureDescriptor has a value
for this (featureDescriptor.getValue(PREFERRED_BINDING_PROPERTY)
is non-null), and the value is true, then the descriptor identifies
a preferred binding property. A class may, and often times does, have
more than one preferred binding property.
Introspector,
FeatureDescriptor,
Constant Field Values| Constructor Detail |
|---|
public PropertyDelegateProvider()
| Method Detail |
|---|
public abstract boolean providesDelegate(java.lang.Class<?> type,
java.lang.String property)
PropertyDelegateProvider provides a delegate
for the Class and property pair.
type - the Classproperty - the property
public abstract java.lang.Object createPropertyDelegate(java.lang.Object source,
java.lang.String property)
PropertyDelegateFactory only invokes this method once for a
particular provider and object pair. For example, consider the following:
PropertyDelegateProvider myProvider = createProvider();
PropertyDelegateFactory.registerPropertyDelegateProvider(
Foo.class, "foo", myProvider);
PropertyDelegateFactory.registerPropertyDelegateProvider(
Foo.class, "value", myProvider);
Then createPropertyDelegate is only invoked once for each
unique instance of Foo.
source - the source to return the property delegate forproperty - the property
null if the pair does not
identify a legal property delegate
java.lang.NullPointerException - if source or property are
nullpublic abstract java.lang.Class<?> getPropertyDelegateClass(java.lang.Class<?> type)
type - the class to obtain the delegate class for
java.lang.NullPointerException - if type is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||