Class Converter<From,To>
java.lang.Object
org.netbeans.validation.api.conversion.Converter<From,To>
- Direct Known Subclasses:
SelectedIndicesToButtonModelArrayConverter, SelectedIndicesToListSelectionModelConverter, StringToComboBoxModelConverter, StringToDocumentConverter
Converts validators. Can convert a
Validator working on one type (such as String)
to a Validator of a different type, such as javax.swing.text.Document.
In this way, it is possible to write only validators
for Strings, but use them against javax.swing.text.Documents (for validating
JTextField and JTextArea components), etc.- Author:
- Tim Boudreau
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWill merge the chain of passed validators to one, and then convert it to the requested type.booleanstatic <From,To> Converter <From, To> Find a converter to create validators for one type from validators for another type.from()inthashCode()static voidRegister a converterto()
-
Constructor Details
-
Converter
-
-
Method Details
-
from
-
to
-
convert
Create aValidatorfor typeTofrom a validator for typeFrom. For example, a converter that is a factory for Validators ofjavax.swing.text.Documents from a validator that only handles Strings may be created. (Convert would simply return a Validatorthat wraps the Validator . At validation time it will first call Document.getText(), and then pass the result to the wrapped Validator ). - Parameters:
from- The original validator.- Returns:
- A validator of the type requested
-
convert
Will merge the chain of passed validators to one, and then convert it to the requested type. Seeconvert(org.netbeans.validation.api.Validator)- Parameters:
froms- A chain of validator to convert.- Returns:
- A validator of the type requested
-
register
Register a converter- Type Parameters:
From-To-- Parameters:
converter-from-to-
-
find
Find a converter to create validators for one type from validators for another type.- Type Parameters:
From- The type of object we get from a component, such as ajavax.swing.text.DocumentTo- The type of object we want to process, such as ajava.lang.String- Parameters:
from- A class, such asDocument.classto- A class such asString.class- Returns:
- An object which can take validators for type
Fromand produce validators for typeTo
-
equals
-
hashCode
-