oracle.cabo.ui.validate
Class ByteLengthValidater
java.lang.Object
|
+--oracle.cabo.ui.validate.BaseClientValidater
|
+--oracle.cabo.ui.validate.ByteLengthValidater
- All Implemented Interfaces:
- ClientValidater, Formatter, ServerValidater
- Direct Known Subclasses:
- Utf8LengthValidater
- public class ByteLengthValidater
- extends BaseClientValidater
- implements Formatter
Validater for validating the byte length of strings.
If the specified encoding is not an encoding specifically supported
by this class, then no client-side
validation will take place, but server-side validation will
still function.
Constructor Summary |
ByteLengthValidater(int maxBytes,
java.lang.String encoding)
Creates a ByteLengthValidater. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteLengthValidater
public ByteLengthValidater(int maxBytes,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
- Creates a ByteLengthValidater.
- Parameters:
maxBytes
- the maximum number of bytes allowed when
the string is encoded as UTF-8.encoding
- the Java character set encoding. This
must be an encoding supported by Java. If it is not an
encoding specifically supported by this class, then no client-side
validation will take place, but server-side validation will
still function.- Throws:
java.io.UnsupportedEncodingException
- if the encoding is
not an encoding supported by Java.
isSingleByteEncoding
public static boolean isSingleByteEncoding(java.lang.String encoding)
- Returns true if the given character set encoding is a single-byte
encoding. This can be used to optimize the use of ByteLengthValidater.
validate
public java.text.ParseException[] validate(RenderingContext context,
java.lang.String value)
formatObject
public java.lang.String formatObject(java.lang.Object value,
LocaleContext localeContext)
- Description copied from interface:
Formatter
- Formats the value into a String in a potentially Locale-specific manner.
- Specified by:
formatObject
in interface Formatter
parseString
public java.lang.Object parseString(java.lang.String value,
LocaleContext localeContext)
throws java.text.ParseException
- Returns the value, unless it is too long, in which
case a ParseException is thrown.
- Specified by:
parseString
in interface Formatter
getValidationFormat
public java.lang.String getValidationFormat(RenderingContext context,
UINode node)
- Overrides:
getValidationFormat
in class BaseClientValidater
getHTMLValidation
protected java.lang.String getHTMLValidation(RenderingContext context)
- Overrides:
getHTMLValidation
in class BaseClientValidater
getHTMLLibReference
protected java.lang.String getHTMLLibReference()
- Description copied from class:
BaseClientValidater
- Returns the name of the Javascript code that this validator requires.
- Overrides:
getHTMLLibReference
in class BaseClientValidater