javax.faces.validator
Class LengthValidator

java.lang.Object
  extended by javax.faces.validator.LengthValidator
All Implemented Interfaces:
EventListener, StateHolder, Validator

@JSFValidator(name="f:validateLength",
              bodyContent="empty",
              tagClass="org.apache.myfaces.taglib.core.ValidateLengthTag")
@JSFJspProperty(name="binding",
                returnType="javax.faces.validator.LengthValidator",
                longDesc="A ValueExpression that evaluates to a LengthValidator.")
public class LengthValidator
extends Object
implements Validator, StateHolder

Creates a validator and associateds it with the nearest parent UIComponent. When invoked, the validator ensures that values are valid strings with a length that lies within the minimum and maximum values specified. Commonly associated with a h:inputText entity. Unless otherwise specified, all attributes accept static values or EL expressions. see Javadoc of JSF Specification

Version:
$Revision: 693358 $ $Date: 2008-09-08 22:54:29 -0500 (Mon, 08 Sep 2008) $
Author:
Manfred Geiler (latest modification by $Author: lu4242 $), Thomas Spiegl

Field Summary
static String MAXIMUM_MESSAGE_ID
           
static String MINIMUM_MESSAGE_ID
           
static String VALIDATOR_ID
           
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
LengthValidator()
           
LengthValidator(int maximum)
           
LengthValidator(int maximum, int minimum)
           
 
Method Summary
 boolean equals(Object o)
           
 int getMaximum()
          The largest value that should be considered valid.
 int getMinimum()
          The smallest value that should be considered valid.
 boolean isTransient()
           
 void restoreState(FacesContext context, Object state)
           
 Object saveState(FacesContext context)
           
 void setMaximum(int maximum)
           
 void setMinimum(int minimum)
           
 void setTransient(boolean transientValue)
           
 void validate(FacesContext facesContext, UIComponent uiComponent, Object value)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXIMUM_MESSAGE_ID

public static final String MAXIMUM_MESSAGE_ID
See Also:
Constant Field Values

MINIMUM_MESSAGE_ID

public static final String MINIMUM_MESSAGE_ID
See Also:
Constant Field Values

VALIDATOR_ID

public static final String VALIDATOR_ID
See Also:
Constant Field Values
Constructor Detail

LengthValidator

public LengthValidator()

LengthValidator

public LengthValidator(int maximum)

LengthValidator

public LengthValidator(int maximum,
                       int minimum)
Method Detail

validate

public void validate(FacesContext facesContext,
                     UIComponent uiComponent,
                     Object value)
              throws ValidatorException
Specified by:
validate in interface Validator
Throws:
ValidatorException

getMaximum

@JSFProperty
public int getMaximum()
The largest value that should be considered valid.


setMaximum

public void setMaximum(int maximum)

getMinimum

@JSFProperty
public int getMinimum()
The smallest value that should be considered valid.


setMinimum

public void setMinimum(int minimum)

isTransient

public boolean isTransient()
Specified by:
isTransient in interface StateHolder

setTransient

public void setTransient(boolean transientValue)
Specified by:
setTransient in interface StateHolder

saveState

public Object saveState(FacesContext context)
Specified by:
saveState in interface StateHolder

restoreState

public void restoreState(FacesContext context,
                         Object state)
Specified by:
restoreState in interface StateHolder

equals

public boolean equals(Object o)
Overrides:
equals in class Object


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.