T
- the type of the represented property.public abstract class PropertySupport<T> extends Node.Property<T>
Node.Property
.Modifier and Type | Class and Description |
---|---|
static class |
PropertySupport.Name
Support for the name property of a node.
|
static class |
PropertySupport.ReadOnly<T>
A simple read-only property.
|
static class |
PropertySupport.ReadWrite<T>
A simple read/write property.
|
static class |
PropertySupport.Reflection<T>
Support for properties from Java Reflection.
|
static class |
PropertySupport.WriteOnly<T>
A simple write-only property.
|
Constructor and Description |
---|
PropertySupport(String name,
Class<T> type,
String displayName,
String shortDescription,
boolean canR,
boolean canW)
Constructs a new support.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Test whether the property is readable.
|
boolean |
canWrite()
Test whether the property is writable.
|
static <T> PropertySupport<T> |
readOnly(String name,
Class<T> valueType,
java.util.function.Supplier<T> supplier)
Creates a read-only "virtual" property where getter is backed by the
provided
Supplier functional interface. |
static <T> PropertySupport<T> |
readWrite(String name,
Class<T> valueType,
java.util.function.Supplier<T> supplier,
java.util.function.Consumer<T> consumer)
|
PropertySupport<T> |
withDisplayName(String displayName)
Fluent wrapper method for
FeatureDescriptor.setDisplayName(java.lang.String) . |
PropertySupport<T> |
withShortDescription(String shortDescription)
Fluent wrapper method for
FeatureDescriptor.setShortDescription(java.lang.String) . |
static <T> PropertySupport<T> |
writeOnly(String name,
Class<T> valueType,
java.util.function.Consumer<T> consumer)
Creates a write-only "virtual" property where setter is backed by the
provided
Consumer functional interface. |
equals, getHtmlDisplayName, getPropertyEditor, getValue, getValueType, hashCode, isDefaultValue, restoreDefaultValue, setValue, supportsDefaultValue
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue, toString
public PropertySupport(String name, Class<T> type, String displayName, String shortDescription, boolean canR, boolean canW)
name
- the name of the propertytype
- the class type of the propertydisplayName
- the display name of the propertycanR
- whether the property is readablecanW
- whether the property is writablepublic boolean canRead()
Node.Property
canRead
in class Node.Property<T>
true
if it ispublic boolean canWrite()
Node.Property
canWrite
in class Node.Property<T>
true
if the read of the value is supportedpublic final PropertySupport<T> withDisplayName(String displayName)
FeatureDescriptor.setDisplayName(java.lang.String)
.displayName
- the display name to set.public final PropertySupport<T> withShortDescription(String shortDescription)
FeatureDescriptor.setShortDescription(java.lang.String)
.shortDescription
- short descriptionpublic static <T> PropertySupport<T> readWrite(String name, Class<T> valueType, java.util.function.Supplier<T> supplier, java.util.function.Consumer<T> consumer)
Supplier
and Consumer
functional interfaces.T
- the type of the propertyname
- the name of the propertyvalueType
- the type of the propertysupplier
- the getter functional interface, can be null
for write-only properties.consumer
- the setter functional interface, can be null
for read-only properties.PropertySupport
instance where getter and setter are
backed by the provided functional interfaces.public static <T> PropertySupport<T> readOnly(String name, Class<T> valueType, java.util.function.Supplier<T> supplier)
Supplier
functional interface.T
- the type of the propertyname
- the name of the propertyvalueType
- the type of the propertysupplier
- the getter functional interface.PropertySupport
instance where getter is
backed by the provided functional interface.public static <T> PropertySupport<T> writeOnly(String name, Class<T> valueType, java.util.function.Consumer<T> consumer)
Consumer
functional interface.T
- the type of the propertyname
- the name of the propertyvalueType
- the type of the propertyconsumer
- the setter functional interface.PropertySupport
instance where setter is
backed by the provided functional interface.