public abstract class Converter<From,To>
extends java.lang.Object
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.| Modifier | Constructor and Description |
|---|---|
protected |
Converter(java.lang.Class<From> from,
java.lang.Class<To> to) |
| Modifier and Type | Method and Description |
|---|---|
Validator<To> |
convert(Validator<From>... froms)
Will merge the chain of passed validators to one, and then convert it to
the requested type.
|
abstract Validator<To> |
convert(Validator<From> from)
|
boolean |
equals(java.lang.Object obj) |
static <From,To> Converter<From,To> |
find(java.lang.Class<From> from,
java.lang.Class<To> to)
Find a converter to create validators for one type from validators for
another type.
|
java.lang.Class<From> |
from() |
int |
hashCode() |
static void |
register(Converter<?,?> converter)
Register a converter
|
java.lang.Class<To> |
to() |
public final java.lang.Class<From> from()
public final java.lang.Class<To> to()
public abstract Validator<To> convert(Validator<From> from)
Validator for type To from a validator for type
From. For example, a converter that is a factory for Validators
of javax.swing.text.Documents from a validator
that only handles Strings may be created. (Convert would simply return a
Validatorfrom - The original validator.public final Validator<To> convert(Validator<From>... froms)
convert(org.netbeans.validation.api.Validator)froms - A chain of validator to convert.public static void register(Converter<?,?> converter)
From - To - from - to - converter - public static <From,To> Converter<From,To> find(java.lang.Class<From> from, java.lang.Class<To> to)
From - The type of object we get from a component, such as a
javax.swing.text.DocumentTo - The type of object we want to process, such as a
java.lang.Stringfrom - A class, such as Document.classto - A class such as String.classFrom
and produce validators for type Topublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object