public class MimeTypePropertyType extends PropertyType<MimeType>
javax.activation.MimeType. aMimeType.match(bMimeType). | Constructor Example | Comments | ||
|---|---|---|---|
Property<MimeType> A_PROPERTY = |
Default value is null. |
||
Property<MimeType> A_PROPERTY = |
Default value is new MimeType("text/html"). |
||
| Type of value(s) | Examples | Result | Comments |
| Valid | text/html | ew MimeType("text/html") | Validate successfully. |
| Invalid | cow | null |
Validate will throw an exception. The resulting value is null. |
| Invalid | «only spaces» | null |
|
| Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null. |
ContentType,
ContentType.getAsMimeType(),
ContentType.parse(String),
ContentType.convert(MimeType),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The type name string constant of MimeTypePropertyType.
|
| Constructor and Description |
|---|
MimeTypePropertyType()
Default constructor, with
null as default value. |
MimeTypePropertyType(MimeType defaultValue)
Constructor.
|
MimeTypePropertyType(String defaultValue)
Constructor, using a string as default value.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equalsMimeType(MimeType mt1,
MimeType mt2)
Since MimType do not implements a property Equals method.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
MimeType |
validateValue(String propertyName,
String value)
Validates the MimeType using the new MimeType(rawvalue) method.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toString, toType, validate, validateConstraints, validateNullTypepublic static final String TYPE
public MimeTypePropertyType()
null as default value.public MimeTypePropertyType(MimeType defaultValue)
defaultValue - the default MimeType value.public MimeTypePropertyType(String defaultValue)
defaultValue - the default value as String, if not valid an error is logged and null used.public List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<MimeType>public MimeType validateValue(String propertyName, String value) throws PropertyException
validateValue in class PropertyType<MimeType>propertyName - the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value - the string representation of the propertyPropertyException - if the conversion failed.MimeType.MimeType(String)public static boolean equalsMimeType(MimeType mt1, MimeType mt2)
mt1 - mt2 - true if both mt1 and mt2 is null, false if either is null, otherwise a match is returned.MimeType.match(MimeType)