|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.adf.view.faces.validator.ByteLengthValidator
ByteLengthValidator is a Validator
that checks
the value of the corresponding component for its byte length for the set
character encoding. The following algorithm is implemented:
null
, exit immediately.ValidatorException
containing a TYPE_MESSAGE_ID message.encoding
and maximumBytes
property
has been configured on this Validator
, check the component
value byte length against the maximum. If the component value byte length
is greater than this specified maximum, throw a ValidatorException
containing a MAXIMUM_MESSAGE_ID message.maximumBytes
property has been configured on this
Validator
, check the component value against
this limit defaulting the encoding to be iso-8859-1
.
If the component value length is greater than the specified maximum,
throw a ValidatorException
containing a MAXIMUM_MESSAGE_ID
message.encoding
property has been configured on this
Validator
, and if it not a valid Java encoding, throw a
ValidatorException
containing a UNSUPPORTED_ENCODING_MESSAGE_ID
message.
Field Summary | |
static java.lang.String |
MAXIMUM_FAILED_AT_INDEX_MESSAGE_ID
The message identifier of the FacesMessage to be created if
the maximum byte length check fails indicating the index where the failure
occurs. |
static java.lang.String |
MAXIMUM_MESSAGE_ID
The message identifier of the FacesMessage to be created if
the maximum byte length check fails. |
static java.lang.String |
TYPE_MESSAGE_ID
The message identifier of the FacesMessage
to be created if the current value of this component is not of the
correct type. |
static java.lang.String |
UNSUPPORTED_ENCODING_MESSAGE_ID
The message identifier of the FacesMessage to be created if
the the encoding is not supported. |
static java.lang.String |
VALIDATOR_ID
Standard validator id for this validator. |
Fields inherited from interface javax.faces.validator.Validator |
NOT_IN_RANGE_MESSAGE_ID |
Constructor Summary | |
ByteLengthValidator()
Construct a Validator with iso-8859-1 as the encoding
and zero as the maximum bytes allowed. |
|
ByteLengthValidator(int maximumBytes,
java.lang.String encoding)
Construct a Validator with the specified preconfigured
values. |
Method Summary | |
boolean |
equals(java.lang.Object object)
Compares this ByteLengthValidator with the specified Object for equality. |
java.lang.String |
getEncoding()
Return the character encoding set for this Validator or
iso-8859-1 if it has not been set. |
int |
getMaximumBytes()
Return the maximum bytes to be enforced by this Validator or zero if it has not been
set. |
int |
hashCode()
Returns the hash code for this Validator. |
boolean |
isTransient()
|
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
|
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
|
void |
setEncoding(java.lang.String encoding)
Set the character encoding for this Validator . |
void |
setMaximumBytes(int maximumBytes)
Set the maximum bytes to be enforced by this Validator . |
void |
setTransient(boolean transientValue)
|
void |
validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
Validates unless it is too long, in which case throws ValidatorException. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String MAXIMUM_MESSAGE_ID
The message identifier of the FacesMessage
to be created if
the maximum byte length check fails. The message format string for this
message may optionally include a {0}
placeholder,
which will be replaced by the maximum bytes set.
public static final java.lang.String MAXIMUM_FAILED_AT_INDEX_MESSAGE_ID
The message identifier of the FacesMessage
to be created if
the maximum byte length check fails indicating the index where the failure
occurs. The message format string for this message may optionally
include a {0}
placeholder, which will be replaced by the
maximum byte length set and {1}
with index at which the
validation fails.
public static final java.lang.String UNSUPPORTED_ENCODING_MESSAGE_ID
The message identifier of the FacesMessage
to be created if
the the encoding is not supported. The message format string for this
message may optionally include a {0}
placeholder, which will
be replaced by the encoding that was set.
public static final java.lang.String TYPE_MESSAGE_ID
The message identifier of the FacesMessage
to be created if the current value of this component is not of the
correct type.
public static final java.lang.String VALIDATOR_ID
Standard validator id for this validator.
Constructor Detail |
public ByteLengthValidator()
Construct a Validator
with iso-8859-1
as the encoding
and zero
as the maximum bytes allowed.
public ByteLengthValidator(int maximumBytes, java.lang.String encoding)
Construct a Validator
with the specified preconfigured
values.
maximumBytes
- the maximum number of bytes allowed.encoding
- the Java character set encoding. This must be
an encoding supported by Java.Method Detail |
public void setEncoding(java.lang.String encoding)
Set the character encoding for this Validator
.
encoding
- The character encoding.public java.lang.String getEncoding()
Return the character encoding set for this Validator
or
iso-8859-1
if it has not been set.
public void setMaximumBytes(int maximumBytes)
Set the maximum bytes to be enforced by this Validator
.
maximumBytes
- The new maximum valuepublic int getMaximumBytes()
Return the maximum bytes to be enforced by this Validator
or zero
if it has not been
set.
public void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value) throws javax.faces.validator.ValidatorException
Validates unless it is too long, in which case throws ValidatorException.
validate
in interface javax.faces.validator.Validator
javax.faces.validator.ValidatorException
- if validation fails
java.lang.NullPointerException
- if context
or component
is null
public java.lang.Object saveState(javax.faces.context.FacesContext context)
saveState
in interface javax.faces.component.StateHolder
public void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
restoreState
in interface javax.faces.component.StateHolder
public boolean isTransient()
isTransient
in interface javax.faces.component.StateHolder
public void setTransient(boolean transientValue)
setTransient
in interface javax.faces.component.StateHolder
public boolean equals(java.lang.Object object)
Compares this ByteLengthValidator with the specified Object for equality.
equals
in class java.lang.Object
object
- Object to which this ByteLengthValidator is to be compared.
public int hashCode()
Returns the hash code for this Validator.
hashCode
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |