public class InputFileSizeValidator extends Object implements Validator, StateHolder
Validates an InputFileInfo
blob value in case it's been uploaded.
Value is set using the "maxSize" attribute and setting it to (for instance)
"10Ko", "10Mo" or "10Go".
Modifier and Type | Field and Description |
---|---|
static String |
MAXIMUM_MESSAGE_ID
The message identifier of the
FacesMessage to be created if the maximum
size check fails. |
static String |
VALIDATOR_ID |
NOT_IN_RANGE_MESSAGE_ID
Constructor and Description |
---|
InputFileSizeValidator() |
Modifier and Type | Method and Description |
---|---|
String |
getMaxSize() |
long |
getMaxSizeBytes() |
boolean |
isTransient() |
void |
restoreState(FacesContext context,
Object state) |
Object |
saveState(FacesContext context) |
void |
setMaxSize(String maxSizeString) |
void |
setTransient(boolean newTransientValue) |
void |
validate(FacesContext context,
UIComponent component,
Object value) |
public static final String VALIDATOR_ID
public static final String MAXIMUM_MESSAGE_ID
FacesMessage
to be created if the maximum
size check fails. The message format string for this message may
optionally include the following placeholders:
{0}
replaced by the configured maximum length.public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
validate
in interface Validator
ValidatorException
public String getMaxSize()
public long getMaxSizeBytes()
public void setMaxSize(String maxSizeString)
public boolean isTransient()
isTransient
in interface StateHolder
public void setTransient(boolean newTransientValue)
setTransient
in interface StateHolder
public Object saveState(FacesContext context)
saveState
in interface StateHolder
public void restoreState(FacesContext context, Object state)
restoreState
in interface StateHolder
Copyright © 2013 Nuxeo SA. All Rights Reserved.