Exposing Processor Properties
Most Processors will require some amount of user configuration before they are able
to be used. The properties that a Processor supports are exposed to the Framework via
the getSupportedPropertyDescriptors
method. This method takes no
arguments and returns a List
of PropertyDescriptor
objects. The order of the objects in the List is important in that it dictates the order
in which the properties will be rendered in the User Interface.
A PropertyDescriptor
object is constructed by creating a new
instance of the PropertyDescriptor.Builder
object, calling the
appropriate methods on the builder, and finally calling the build
method.
While this method covers most of the use cases, it is sometimes desirable to allow
users to configure additional properties whose name are not known. This can be achieved
by overriding the getSupportedDynamicPropertyDescriptor
method. This
method takes a String
as its only argument, which indicates the name
of the property. The method returns a PropertyDescriptor
object that
can be used to validate both the name of the property, as well as the value. Any
PropertyDescriptor that is returned from this method should be built setting the value
of isDynamic
to true in the
PropertyDescriptor.Builder
class. The default behavior of
AbstractProcessor is to not allow any dynamically created properties.