|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.globalmentor.beans.BoundPropertyObject
com.guiseframework.event.GuiseBoundPropertyObject
com.guiseframework.validator.AbstractValidator<ResourceImport>
com.guiseframework.validator.ResourceImportValidator
public class ResourceImportValidator
A resource import validator that can validate resource imports against accepted content types, file extensions, and/or maximum size.
If accepted content types are specified, the set needs to contain the null value if resource imports with no content type are to be allowed.
Not providing a set of accepted content types allows any content types.
If accepted filename extensions are specified, the set needs to contain the null value if resource imports with no extension are to be allowed.
Not providing a set of accepted filename extensions allows any extensions.
If a maximum content length of -1 is specified, any content length, including an undefined content length, will be accepted.
Specifying a content length greater than zero will never allow a resource with an undefined content length.
| Field Summary |
|---|
| Fields inherited from class com.globalmentor.beans.BoundPropertyObject |
|---|
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS |
| Fields inherited from interface com.guiseframework.validator.Validator |
|---|
INVALID_VALUE_MESSAGE_PROPERTY, VALUE_REQUIRED_MESSAGE_PROPERTY, VALUE_REQUIRED_PROPERTY |
| Constructor Summary | |
|---|---|
ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType)
Accepted content type constructor. |
|
ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType,
boolean valueRequired)
Accepted content type, and value required constructor. |
|
ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType,
long maxContentLength)
Accepted content type and maximum content length constructor. |
|
ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType,
long maxContentLength,
boolean valueRequired)
Accepted content type, maximum content length, and value required constructor. |
|
ResourceImportValidator(GuiseSession session)
Default constructor. |
|
ResourceImportValidator(long maxContentLength)
Maximum content length constructor. |
|
ResourceImportValidator(long maxContentLength,
boolean valueRequired)
Maximum content length and value required constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes)
Accepted content types constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
boolean valueRequired)
Accepted content types and value required constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
long maxContentLength)
Accepted content types and maximum content length constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
long maxContentLength,
boolean valueRequired)
Accepted content types, maximum content length, and value required constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions)
Accepted content types, and accepted extensions constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions,
boolean valueRequired)
Accepted content types, accepted extensions, and value required constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions,
long maxContentLength)
Accepted content types, accepted extensions, and maximum content length constructor. |
|
ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions,
long maxContentLength,
boolean valueRequired)
Accepted content types, accepted extensions, maximum content length, and value required constructor. |
|
| Method Summary | |
|---|---|
java.util.Set<com.globalmentor.net.ContentType> |
getAcceptedContentTypes()
|
java.util.Set<java.lang.String> |
getAcceptedExtensions()
|
long |
getMaxContentLength()
|
protected java.lang.String |
toString(ResourceImport resourceImport)
Retrieves a string representation of the given value appropriate for error messages. |
void |
validate(ResourceImport resourceImport)
Determines whether a given resource import meets the provided criteria. |
| Methods inherited from class com.guiseframework.validator.AbstractValidator |
|---|
getInvalidValueMessage, getValueRequiredMessage, isValid, isValueRequired, setInvalidValueMessage, setValueRequired, setValueRequiredMessage, throwInvalidValueValidationException, throwValueRequiredValidationException |
| Methods inherited from class com.guiseframework.event.GuiseBoundPropertyObject |
|---|
getSession |
| Methods inherited from class com.globalmentor.beans.BoundPropertyObject |
|---|
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.guiseframework.validator.Validator |
|---|
getSession |
| Methods inherited from interface com.globalmentor.beans.PropertyBindable |
|---|
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Constructor Detail |
|---|
public ResourceImportValidator(GuiseSession session)
public ResourceImportValidator(long maxContentLength)
maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.
public ResourceImportValidator(long maxContentLength,
boolean valueRequired)
maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.valueRequired - Whether the value must be non-null in order to be considered valid.public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.public ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType)
acceptedContentType - The single accepted content types.
public ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType,
boolean valueRequired)
acceptedContentType - The single accepted content types.valueRequired - Whether the value must be non-null in order to be considered valid.
public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
boolean valueRequired)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.valueRequired - Whether the value must be non-null in order to be considered valid.
public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
long maxContentLength)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.
public ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType,
long maxContentLength)
acceptedContentType - The single accepted content type.maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.
public ResourceImportValidator(com.globalmentor.net.ContentType acceptedContentType,
long maxContentLength,
boolean valueRequired)
acceptedContentType - The single accepted content type.maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.valueRequired - Whether the value must be non-null in order to be considered valid.
public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
long maxContentLength,
boolean valueRequired)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.valueRequired - Whether the value must be non-null in order to be considered valid.
public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.acceptedExtensions - The accepted filename extensions, or null if all filename extensions are accepted.
public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions,
boolean valueRequired)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.acceptedExtensions - The accepted filename extensions, or null if all filename extensions are accepted.valueRequired - Whether the value must be non-null in order to be considered valid.
public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions,
long maxContentLength)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.acceptedExtensions - The accepted filename extensions, or null if all filename extensions are accepted.maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.
public ResourceImportValidator(java.util.Set<com.globalmentor.net.ContentType> acceptedContentTypes,
java.util.Set<java.lang.String> acceptedExtensions,
long maxContentLength,
boolean valueRequired)
acceptedContentTypes - The accepted content types, each of which can have the special wildcard ("*") subtype, or null if all content types are accepted.acceptedExtensions - The accepted filename extensions, or null if all filename extensions are accepted.maxContentLength - The maximum content length to accept, or -1 if there is no limit to the content length.valueRequired - Whether the value must be non-null in order to be considered valid.| Method Detail |
|---|
public java.util.Set<com.globalmentor.net.ContentType> getAcceptedContentTypes()
null if all content types are accepted.public java.util.Set<java.lang.String> getAcceptedExtensions()
null if all filename extensions are accepted.public long getMaxContentLength()
public void validate(ResourceImport resourceImport)
throws ValidationException
null values are allowed.
validate in interface Validator<ResourceImport>validate in class AbstractValidator<ResourceImport>resourceImport - The resource import to validate, which may be null.
ValidationException - if the provided value is not valid.getAcceptedContentTypes(),
getAcceptedExtensions(),
getMaxContentLength()protected java.lang.String toString(ResourceImport resourceImport)
toString in class AbstractValidator<ResourceImport>resourceImport - The value for which a string representation should be returned.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||