|
install4j API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PropertyConverter
A property converter translates between a string representation and the actual object state and provides
an optional property customizer
.
Property converters are registered on a per-bean basis with
Install4JBeanInfo.setPropertyConverters(PropertyConverter[])
.
This class and the PropertyConverter
class are similar to the PropertyEditor
class
which was not used in the install4j API since the editing concepts of the install4j IDE do not quite match with the
ideas in the java.beans API.
In concept, this class is similar to the EnumerationMapper
class.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_CONTEXT
A default context that you can use in the getContext() method if there is only one
property converter for the property type returned by getPropertyClass() |
Method Summary | |
---|---|
java.lang.Object |
fromString(java.lang.String string)
Converts a string representation to an object of type getPropertyClass() . |
java.lang.String |
getContext()
The property descriptor of a property that wants to use this property converter must have a non-null context that corresponds to the return value of this method. |
java.lang.Class |
getPropertyClass()
Returns the property type for which this property converter is eligible. |
java.lang.Class |
getPropertyCustomizerClass()
Returns the class of the optional property customizer. |
boolean |
supportsFromString()
Returns if the property converter is able to convert a string representation to an object. |
java.lang.String |
toString(java.lang.Object object)
Converts the property value to a string value. |
Field Detail |
---|
static final java.lang.String DEFAULT_CONTEXT
getContext()
method if there is only one
property converter for the property type returned by getPropertyClass()
Method Detail |
---|
java.lang.Class getPropertyClass()
java.lang.String getContext()
For classes that do not have default handlers in install4j,
the property converter will also be used if this method returns DEFAULT_CONTEXT
, the
getPropertyClass()
method returns the class of the property and the context of the property is not set.
However, it is safer not to rely on that behavior.
java.lang.String toString(java.lang.Object object)
supportsFromString()
returns true, the string value must be valid input for
fromString(String)
and return an object with the same internal state.
object
- the property value of the type returned by getPropertyClass()
or possibly of a derived class
boolean supportsFromString()
toString(Object)
in the install4j IDE.
java.lang.Object fromString(java.lang.String string)
getPropertyClass()
.
When editing of the property is completed in the install4j IDE, this method will be called to construct an object that will be set as the
property value. This method is only called if supportsFromString()
returns true.
string
- the string representation
java.lang.Class getPropertyCustomizerClass()
PropertyCustomizer
and return the name of your property customizer class,
otherwise return null.
If a non-null value is returned, the user will see a "..." button in the install4j IDE that brings up the dialog with the property customizer.
|
install4j API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |