com.uwyn.rife.site
Class ConstrainedProperty<T extends ConstrainedProperty>

java.lang.Object
  extended by com.uwyn.rife.site.ConstrainedProperty<T>
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CmfProperty

public class ConstrainedProperty<T extends ConstrainedProperty>
extends Object
implements Cloneable

A ConstrainedProperty object makes it possible to easily define all constraints for a named property of a bean.

The property name refers to the actual name of the bean property. However, this sometimes doesn't correspond to its conceptual usage. It can be handy to receive constraint violation reports with another conceptual name: the subject name. Notice that this corresponds to the subject that is used in a ValidationError. If no subject name is specified, the property name will be used instead.

It's possible to add constraints to a ConstrainedProperty instance through regular setters, but chainable setters are also available to make it possible to easily define a series of constraints, for example:

ConstrainedProperty constrained = new ConstrainedProperty("password")
    .maxLength(8)
    .notNull(true);

Constrained properties are typically added to a Constrained bean in its constructor. These are the static constraints that will be set for each and every instance of the bean. You'll however most of the time use the MetaData class that provides the activateMetaData method which initializes the constraints on a need-to-have basis. This dramatically reduces memory usage since otherwise all constraints will be initialized for every bean instance, even though you don't use them, for example:

public class Credentials extends MetaData
{
    private String mLogin = null;
    private String mPassword = null;
    private String mLanguage = null;

    public Credentials()
    {
    }

    public activateMetaData()
    {
        addConstraint(new ConstrainedProperty("login").maxLength(6).notNull(true));
        addConstraint(new ConstrainedProperty("password").maxLength(8).notNull(true));
        addConstraint(new ConstrainedProperty("language").notNull(true));
    }

    public void setLogin(String login) { mLogin = login; }
    public String getLogin() { return mLogin; }
    public void setPassword(String password) { mPassword = password; }
    public String getPassword() { return mPassword; }
    public void setLanguage(String language) { mLanguage = language; }
    public String getLanguage() { return mLanguage; }
}

It's however also possible to add constraints to a single bean instance whenever they can't be determined beforehand. These are then dynamic constraints than can be populated at runtime, for example:

Credentials credentials = new Credentials();
credentials.addConstraint(new ConstrainedProperty("language").inList(new String[] {"nl", "fr", "en"}));

Since:
1.0
Version:
$Revision: 3732 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)
See Also:
Constrained, ConstrainedBean

Nested Class Summary
 class ConstrainedProperty.ManyToMany
           
 class ConstrainedProperty.ManyToManyAssociation
           
 class ConstrainedProperty.ManyToOne
           
 class ConstrainedProperty.ManyToOneAssociation
           
 
Field Summary
static String AUTO_RETRIEVED
           
static String CACHED_LOADED_DATA
           
static String CONTENT_ATTRIBUTES
           
static String DEFAULT_VALUE
           
static String DISPLAYED_RAW
           
static String EDITABLE
           
static String EMAIL
           
static String FILE
           
static String FORMAT
           
static String FRAGMENT
           
static String IDENTIFIER
           
static String IN_LIST
           
static String LISTED
           
static String MANY_TO_MANY
           
static String MANY_TO_MANY_ASSOCIATION
           
static String MANY_TO_ONE
           
static String MANY_TO_ONE_ASSOCIATION
           
static String MAX_DATE
           
static String MAX_LENGTH
           
protected  Map<String,Object> mConstraints
           
static String MIMETYPE
           
static String MIN_DATE
           
static String MIN_LENGTH
           
protected  List<ConstrainedPropertyListener> mListeners
           
static String NAME
           
static String NOT_EMPTY
           
static String NOT_EQUAL
           
static String NOT_NULL
           
static String ORDINAL
           
static String ORDINAL_RESTRICTION
           
static String PERSISTENT
           
static String POSITION
           
static String RANGE_BEGIN
           
static String RANGE_END
           
static String REGEXP
           
static String REPOSITORY
           
static String SAME_AS
           
static String SAVED
           
static String SCALE
           
static String SPARSE
           
static String TRANSFORMER
           
static String UNIQUE
           
static String URL
           
 
Constructor Summary
ConstrainedProperty(String propertyName)
          Creates a new ConstrainedProperty for the specified property name.
 
Method Summary
 void addListener(ConstrainedPropertyListener listener)
          Adds a new listener.
 T autoRetrieved(boolean autoRetrieved)
          Sets whether the content data of this property should be retrieved automatically from the back-end.
 ConstrainedProperty clone()
           
 T constraint(String name, Object constraintData)
          Sets the data of a particular constraint in a generic fashion.
 T contentAttribute(String name, boolean value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, byte value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, char value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, double value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, float value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, int value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, long value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, short value)
          Sets a named content attribute for this property that will be converted internally to a String value.
 T contentAttribute(String name, String value)
          Sets a named content attribute for this property.
 T defaultValue(boolean value)
           
 T defaultValue(byte value)
           
 T defaultValue(char value)
           
 T defaultValue(double value)
           
 T defaultValue(float value)
           
 T defaultValue(int value)
           
 T defaultValue(long value)
           
 T defaultValue(Object value)
           
 T defaultValue(short value)
           
 T displayedRaw(boolean displayedRaw)
           
 T editable(boolean editable)
           
 T email(boolean email)
           
 T file(boolean file)
           
 T format(Format format)
           
 T fragment(boolean fragment)
          Sets whether the content data of this property is a fragment.
 Object getCachedLoadedData()
          Retrieves the cached loaded content data.
 Object getConstraint(String name)
          Retrieves the value of a particular constraint in a generic fashion
 Map<String,Object> getConstraints()
          Retrieves the map of all the constraints.
 Map<String,String> getContentAttributes()
          Retrieves the map of named content attributes for this property.
 Object getDefaultValue()
           
 Format getFormat()
           
 String[] getInList()
           
 ConstrainedProperty.ManyToMany getManyToMany()
           
 ConstrainedProperty.ManyToManyAssociation getManyToManyAssociation()
           
 ConstrainedProperty.ManyToOne getManyToOne()
           
 ConstrainedProperty.ManyToOneAssociation getManyToOneAssociation()
           
 Date getMaxDate()
           
 int getMaxLength()
           
 MimeType getMimeType()
          Retrieves the mime type of the property.
 Date getMinDate()
           
 int getMinLength()
           
 String getName()
          Retrieves the name of this property.
 Object getNotEqual()
          Retrieves the reference object to which the property value can't be equal.
 String getOrdinalRestriction()
          Retrieves the ordinal restriction of this property.
 int getPosition()
          Retrieves the position in which the property should be displayed.
 int getPrecision()
           
 String getPropertyName()
          Retrieves the property name.
 Comparable getRangeBegin()
           
 Comparable getRangeEnd()
           
 String getRegexp()
           
 String getRepository()
          Retrieves the repository where the content data of this property will be stored.
 String getSameAs()
           
 int getScale()
           
 String getSubjectName()
          Retrieves the subject name.
 ContentTransformer getTransformer()
          Retrieves the content transformer of this property.
 boolean hasDefaultValue()
           
 boolean hasLimitedLength()
           
 boolean hasManyToMany()
           
 boolean hasManyToManyAssociation()
           
 boolean hasManyToOne()
           
 boolean hasManyToOneAssociation()
           
 boolean hasMaxLength()
           
 boolean hasMimeType()
          Indicates whether the property has a mime type.
 boolean hasMixLength()
           
 boolean hasName()
          Indicates whether this property has a name.
 boolean hasOrdinalRestriction()
          Indicates whether this property has an ordinal restricting column.
 boolean hasPosition()
          Indicates whether the position of the property is set.
 boolean hasPrecision()
           
 boolean hasRepository()
          Indicates whether this property will be stored in another repository than the default repository.
 boolean hasScale()
           
 boolean hasTransformer()
          Indicates whether this property has a content transformer.
 T identifier(boolean identifier)
          Set whether the property value is an identifier.
 T inList(byte... inList)
           
 T inList(char... inList)
           
 T inList(Collection inList)
           
 T inList(double... inList)
           
 T inList(float... inList)
           
 T inList(int... inList)
           
 T inList(long... inList)
           
 T inList(short... inList)
           
 T inList(String... inList)
           
 boolean isAutoRetrieved()
          Indicates whether the content data of this property is automatically retrieved from the back-end.
 boolean isDisplayedRaw()
           
 boolean isEditable()
           
 boolean isEmail()
           
 boolean isFile()
           
 boolean isFormatted()
           
 boolean isFragment()
          Indicates whether the content data of this property is a fragment.
 boolean isIdentifier()
          Retrieves whether the property is an identifier.
 boolean isInList()
           
 boolean isLimitedDate()
           
 boolean isListed()
          Retrieves whether the property should be included in data lists.
 boolean isNotEmpty()
          Retrieves whether the property value can be empty.
 boolean isNotEqual()
          Retrieves whether the property can't be equal to a specific reference value.
 boolean isNotNull()
          Retrieves whether the property value can be null.
 boolean isOrdinal()
          Indicates whether this property has to be used as an ordinal.
 boolean isPersistent()
           
 boolean isRange()
           
 boolean isSameAs()
           
 boolean isSaved()
           
 boolean isSparse()
           
 boolean isUnique()
          Retrieves whether the property value has to be unique.
 boolean isUrl()
           
 T listed(boolean listed)
          Sets whether the property should be included in data lists.
 T manyToMany()
           
 T manyToMany(Class klass)
           
 T manyToMany(Class klass, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 T manyToMany(CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 T manyToManyAssociation()
           
 T manyToManyAssociation(Class klass, String property)
           
 T manyToManyAssociation(String property)
           
 T manyToOne()
           
 T manyToOne(Class klass)
           
 T manyToOne(Class klass, String columnReference)
           
 T manyToOne(Class klass, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 T manyToOne(String table, String columnReference)
           
 T manyToOne(String table, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 T manyToOneAssociation()
           
 T manyToOneAssociation(Class klass, String property)
           
 T manyToOneAssociation(String property)
           
 boolean matchesRegexp()
           
 T maxDate(Date maxDate)
           
 T maxLength(int maxLength)
           
 T mimeType(MimeType mimeType)
          Sets the mime type of the property.
 T minDate(Date minDate)
           
 T minLength(int minLength)
           
 T name(String name)
          Sets the name of the content data of this property.
 T notEmpty(boolean notEmpty)
          Set whether the property value can be empty.
 T notEqual(boolean reference)
          Set that the property value can't be equal to a specified boolean reference value.
 T notEqual(byte reference)
          Set that the property value can't be equal to a specified byte reference value.
 T notEqual(char reference)
          Set that the property value can't be equal to a specified char reference value.
 T notEqual(double reference)
          Set that the property value can't be equal to a specified double reference value.
 T notEqual(float reference)
          Set that the property value can't be equal to a specified float reference value.
 T notEqual(int reference)
          Set that the property value can't be equal to a specified int reference value.
 T notEqual(long reference)
          Set that the property value can't be equal to a specified long reference value.
 T notEqual(Object reference)
          Set that the property value can't be equal to a specified Object reference value.
 T notEqual(short reference)
          Set that the property value can't be equal to a specified short reference value.
 T notNull(boolean notNull)
          Set whether the property value can be null.
 T ordinal(boolean ordinal)
          Sets whether this property has to be used as an ordinal.
 T ordinal(boolean ordinal, String restriction)
          Sets whether this property has to be used as an ordinal with a restricting column.
 T persistent(boolean persistent)
           
 T position(int position)
          Sets the position in which the property should be displayed.
 T precision(int precision)
           
 T rangeBegin(byte value)
           
 T rangeBegin(char value)
           
 T rangeBegin(Comparable value)
           
 T rangeBegin(double value)
           
 T rangeBegin(float value)
           
 T rangeBegin(int value)
           
 T rangeBegin(long value)
           
 T rangeBegin(short value)
           
 T rangeEnd(byte value)
           
 T rangeEnd(char value)
           
 T rangeEnd(Comparable value)
           
 T rangeEnd(double value)
           
 T rangeEnd(float value)
           
 T rangeEnd(int value)
           
 T rangeEnd(long value)
           
 T rangeEnd(short value)
           
 T regexp(String regexp)
           
 boolean removeListener(ConstrainedPropertyListener listener)
          Removes a listener.
 T repository(String repository)
          Sets the repository where the content data of this property will be stored.
 T sameAs(String reference)
           
 T saved(boolean saved)
           
 T scale(int scale)
           
 void setAutoRetrieved(boolean autoRetrieved)
          Sets whether the content data of this property should be retrieved automatically from the back-end.
 void setCachedLoadedData(Object data)
          Sets the cached loaded data.
 void setConstraint(String name, Object constraintData)
          Sets the data of a particular constraint in a generic fashion.
 void setDefaultValue(Object value)
           
 void setDisplayedRaw(boolean displayedRaw)
           
 void setEditable(boolean editable)
           
 void setEmail(boolean email)
           
 void setFile(boolean file)
           
 void setFormat(Format format)
           
 void setFragment(boolean fragment)
          Sets whether the content data of this property is a fragment.
 void setIdentifier(boolean identifier)
          Set whether the property value is an identifier.
 void setInList(byte... inList)
           
 void setInList(char... inList)
           
 void setInList(Collection inList)
           
 void setInList(double... inList)
           
 void setInList(float... inList)
           
 void setInList(int... inList)
           
 void setInList(long... inList)
           
 void setInList(short... inList)
           
 void setInList(String... inList)
           
 void setListed(boolean listed)
          Sets whether the property should be included in data lists.
 void setManyToMany()
           
 void setManyToMany(Class klass)
           
 void setManyToMany(Class klass, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 void setManyToMany(CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 void setManyToManyAssociation()
           
 void setManyToManyAssociation(Class klass, String property)
           
 void setManyToManyAssociation(String property)
           
 void setManyToOne()
           
 void setManyToOne(Class klass)
           
 void setManyToOne(Class klass, String columnReference)
           
 void setManyToOne(Class klass, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 void setManyToOne(String table, String columnReference)
           
 void setManyToOne(String table, String columnReference, CreateTable.ViolationAction onUpdate, CreateTable.ViolationAction onDelete)
           
 void setManyToOneAssociation()
           
 void setManyToOneAssociation(Class klass, String property)
           
 void setManyToOneAssociation(String property)
           
 void setMaxDate(Date maxDate)
           
 void setMaxLength(int maxLength)
           
 void setMimeType(MimeType mimeType)
          Sets the mime type of the property.
 void setMinDate(Date minDate)
           
 void setMinLength(int minLength)
           
 void setName(String name)
          Sets the name of the content data of this property.
 void setNotEmpty(boolean notEmpty)
          Set whether the property value can be empty.
 void setNotEqual(boolean reference)
          Set that the property value can't be equal to a specified boolean reference value.
 void setNotEqual(byte reference)
          Set that the property value can't be equal to a specified byte reference value.
 void setNotEqual(char reference)
          Set that the property value can't be equal to a specified char reference value.
 void setNotEqual(double reference)
          Set that the property value can't be equal to a specified double reference value.
 void setNotEqual(float reference)
          Set that the property value can't be equal to a specified float reference value.
 void setNotEqual(int reference)
          Set that the property value can't be equal to a specified int reference value.
 void setNotEqual(long reference)
          Set that the property value can't be equal to a specified long reference value.
 void setNotEqual(Object reference)
          Set that the property value can't be equal to a specified Object reference value.
 void setNotEqual(short reference)
          Set that the property value can't be equal to a specified short reference value.
 void setNotNull(boolean notNull)
          Set whether the property value can be null.
 void setOrdinal(boolean ordinal)
          Sets whether this property has to be used as an ordinal.
 void setOrdinal(boolean ordinal, String restriction)
          Sets whether this property has to be used as an ordinal with a restricting column.
 void setPersistent(boolean persistent)
           
 void setPosition(int position)
          Sets the position in which the property should be displayed.
 void setPrecision(int precision)
           
 void setRangeBegin(byte value)
           
 void setRangeBegin(char value)
           
 void setRangeBegin(Comparable rangeBegin)
           
 void setRangeBegin(double value)
           
 void setRangeBegin(float value)
           
 void setRangeBegin(int value)
           
 void setRangeBegin(long value)
           
 void setRangeBegin(short value)
           
 void setRangeEnd(byte value)
           
 void setRangeEnd(char value)
           
 void setRangeEnd(Comparable rangeEnd)
           
 void setRangeEnd(double value)
           
 void setRangeEnd(float value)
           
 void setRangeEnd(int value)
           
 void setRangeEnd(long value)
           
 void setRangeEnd(short value)
           
 void setRegexp(String regexp)
           
 void setRepository(String repository)
          Sets the repository where the content data of this property will be stored.
 void setSameAs(String reference)
           
 void setSaved(boolean saved)
           
 void setScale(int scale)
           
 void setSparse(boolean sparse)
           
 void setSubjectName(String name)
          Sets the subject name.
 void setTransformer(ContentTransformer transformer)
          Sets a content transformer for this property.
 void setUnique(boolean unique)
          Set whether the property value has to be unique.
 void setUrl(boolean url)
           
 T sparse(boolean sparse)
           
 T subjectName(String name)
          Sets the subject name.
 T transformer(ContentTransformer transformer)
          Sets a content transformer for this property.
 T unique(boolean unique)
          Set whether the property value has to be unique.
 T url(boolean url)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_NULL

public static final String NOT_NULL
See Also:
Constant Field Values

NOT_EMPTY

public static final String NOT_EMPTY
See Also:
Constant Field Values

NOT_EQUAL

public static final String NOT_EQUAL
See Also:
Constant Field Values

UNIQUE

public static final String UNIQUE
See Also:
Constant Field Values

IDENTIFIER

public static final String IDENTIFIER
See Also:
Constant Field Values

EDITABLE

public static final String EDITABLE
See Also:
Constant Field Values

PERSISTENT

public static final String PERSISTENT
See Also:
Constant Field Values

SAVED

public static final String SAVED
See Also:
Constant Field Values

DISPLAYED_RAW

public static final String DISPLAYED_RAW
See Also:
Constant Field Values

MIN_LENGTH

public static final String MIN_LENGTH
See Also:
Constant Field Values

MAX_LENGTH

public static final String MAX_LENGTH
See Also:
Constant Field Values

SCALE

public static final String SCALE
See Also:
Constant Field Values

REGEXP

public static final String REGEXP
See Also:
Constant Field Values

EMAIL

public static final String EMAIL
See Also:
Constant Field Values

URL

public static final String URL
See Also:
Constant Field Values

MIN_DATE

public static final String MIN_DATE
See Also:
Constant Field Values

MAX_DATE

public static final String MAX_DATE
See Also:
Constant Field Values

IN_LIST

public static final String IN_LIST
See Also:
Constant Field Values

RANGE_BEGIN

public static final String RANGE_BEGIN
See Also:
Constant Field Values

RANGE_END

public static final String RANGE_END
See Also:
Constant Field Values

DEFAULT_VALUE

public static final String DEFAULT_VALUE
See Also:
Constant Field Values

SAME_AS

public static final String SAME_AS
See Also:
Constant Field Values

MANY_TO_ONE

public static final String MANY_TO_ONE
See Also:
Constant Field Values

MANY_TO_ONE_ASSOCIATION

public static final String MANY_TO_ONE_ASSOCIATION
See Also:
Constant Field Values

MANY_TO_MANY

public static final String MANY_TO_MANY
See Also:
Constant Field Values

MANY_TO_MANY_ASSOCIATION

public static final String MANY_TO_MANY_ASSOCIATION
See Also:
Constant Field Values

FORMAT

public static final String FORMAT
See Also:
Constant Field Values

FILE

public static final String FILE
See Also:
Constant Field Values

SPARSE

public static final String SPARSE
See Also:
Constant Field Values

LISTED

public static final String LISTED
See Also:
Constant Field Values

POSITION

public static final String POSITION
See Also:
Constant Field Values

MIMETYPE

public static final String MIMETYPE
See Also:
Constant Field Values

AUTO_RETRIEVED

public static final String AUTO_RETRIEVED
See Also:
Constant Field Values

FRAGMENT

public static final String FRAGMENT
See Also:
Constant Field Values

NAME

public static final String NAME
See Also:
Constant Field Values

REPOSITORY

public static final String REPOSITORY
See Also:
Constant Field Values

ORDINAL

public static final String ORDINAL
See Also:
Constant Field Values

ORDINAL_RESTRICTION

public static final String ORDINAL_RESTRICTION
See Also:
Constant Field Values

CONTENT_ATTRIBUTES

public static final String CONTENT_ATTRIBUTES
See Also:
Constant Field Values

TRANSFORMER

public static final String TRANSFORMER
See Also:
Constant Field Values

CACHED_LOADED_DATA

public static final String CACHED_LOADED_DATA
See Also:
Constant Field Values

mConstraints

protected Map<String,Object> mConstraints

mListeners

protected List<ConstrainedPropertyListener> mListeners
Constructor Detail

ConstrainedProperty

public ConstrainedProperty(String propertyName)
Creates a new ConstrainedProperty for the specified property name.

Parameters:
propertyName - the name of the property that has to be constrained
Since:
1.0
Method Detail

addListener

public void addListener(ConstrainedPropertyListener listener)
Adds a new listener.

Listeners will be notified when events occur that are specified in the ConstrainedPropertyListener interface.

Parameters:
listener - the listener instance that will be added
Since:
1.6

removeListener

public boolean removeListener(ConstrainedPropertyListener listener)
Removes a listener.

Once the listener has been removed, it will not receive any events anymore.

Parameters:
listener - the listener instance that will be removed
Returns:
true when the listener could be found and has been removed; or

false when the listener wasn't registered before

Since:
1.6

subjectName

public T subjectName(String name)
Sets the subject name.

Parameters:
name - the subject name
Returns:
this ConstrainedProperty
Since:
1.0

setSubjectName

public void setSubjectName(String name)
Sets the subject name.

Parameters:
name - the subject name
Since:
1.0

getSubjectName

public String getSubjectName()
Retrieves the subject name.

Returns:
the subject name; or

the property name if no subject was specified.

Since:
1.0

getPropertyName

public String getPropertyName()
Retrieves the property name.

Returns:
the property name
Since:
1.0

notNull

public T notNull(boolean notNull)
Set whether the property value can be null.

Note that this has different meanings in different contexts:

Parameters:
notNull - true when the value can't be null; or false when the value can be null.
Returns:
this ConstrainedProperty
Since:
1.0
See Also:
isNotNull()

setNotNull

public void setNotNull(boolean notNull)
Set whether the property value can be null.

Since:
1.0
See Also:
notNull(boolean)

isNotNull

public boolean isNotNull()
Retrieves whether the property value can be null.

Returns:
true when the value can't be null; or

false when the value can be null.

Since:
1.0
See Also:
notNull(boolean)

notEmpty

public T notEmpty(boolean notEmpty)
Set whether the property value can be empty.

Note that this has different meanings for different datatypes

Parameters:
notEmpty - true when the value can't be empty; or false when the value can be empty.
Returns:
this ConstrainedProperty
Since:
1.0
See Also:
isNotEmpty()

setNotEmpty

public void setNotEmpty(boolean notEmpty)
Set whether the property value can be empty.

Since:
1.0
See Also:
notEmpty(boolean)

isNotEmpty

public boolean isNotEmpty()
Retrieves whether the property value can be empty.

Returns:
true when the value can't be empty; or

false when the value can be empty.

Since:
1.0
See Also:
notEmpty(boolean)

notEqual

public T notEqual(boolean reference)
Set that the property value can't be equal to a specified boolean reference value.

Parameters:
reference - the reference value it will be checked against
Returns:
this ConstrainedProperty
Since:
1.0
See Also:
isNotEqual()

notEqual

public T notEqual(byte reference)
Set that the property value can't be equal to a specified byte reference value.

Since:
1.0
See Also:
notEqual(boolean)

notEqual

public T notEqual(char reference)
Set that the property value can't be equal to a specified char reference value.

Since:
1.0
See Also:
notEqual(boolean)

notEqual

public T notEqual(short reference)
Set that the property value can't be equal to a specified short reference value.

Since:
1.0
See Also:
notEqual(boolean)

notEqual

public T notEqual(int reference)
Set that the property value can't be equal to a specified int reference value.

Since:
1.0
See Also:
notEqual(boolean)

notEqual

public T notEqual(long reference)
Set that the property value can't be equal to a specified long reference value.

Since:
1.0
See Also:
notEqual(boolean)

notEqual

public T notEqual(float reference)
Set that the property value can't be equal to a specified float reference value.

Since:
1.0
See Also:
notEqual(boolean)

notEqual

public T notEqual(double reference)
Set that the property value can't be equal to a specified double reference value.

Since:
1.0
See Also:
notEqual(boolean)

notEqual

public T notEqual(Object reference)
Set that the property value can't be equal to a specified Object reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(boolean reference)
Set that the property value can't be equal to a specified boolean reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(byte reference)
Set that the property value can't be equal to a specified byte reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(char reference)
Set that the property value can't be equal to a specified char reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(short reference)
Set that the property value can't be equal to a specified short reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(int reference)
Set that the property value can't be equal to a specified int reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(long reference)
Set that the property value can't be equal to a specified long reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(float reference)
Set that the property value can't be equal to a specified float reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(double reference)
Set that the property value can't be equal to a specified double reference value.

Since:
1.0
See Also:
notEqual(boolean)

setNotEqual

public void setNotEqual(Object reference)
Set that the property value can't be equal to a specified Object reference value.

Since:
1.0
See Also:
notEqual(boolean)

isNotEqual

public boolean isNotEqual()
Retrieves whether the property can't be equal to a specific reference value.

Returns:
true when the value can't be equal; or

false when the value can be equal.

Since:
1.0
See Also:
notEqual(boolean)

getNotEqual

public Object getNotEqual()
Retrieves the reference object to which the property value can't be equal.

Returns:
the requested reference object instance; or

null when the property has no notEqual constraint.

Since:
1.0
See Also:
notEqual(boolean)

unique

public T unique(boolean unique)
Set whether the property value has to be unique.

Note that this is only applicable to contexts where a collection of the data is stored an that uniqueness can apply against the other entries. In a singular context, uniqueness is always guaranteed.

Parameters:
unique - true when the value has to be unique; or false when it doesn't have to be.
Returns:
this ConstrainedProperty
Since:
1.0
See Also:
isUnique()

setUnique

public void setUnique(boolean unique)
Set whether the property value has to be unique.

Since:
1.0
See Also:
unique(boolean)

isUnique

public boolean isUnique()
Retrieves whether the property value has to be unique.

Returns:
true when the value has to be unique; or

false it doesn't have to be.

Since:
1.0
See Also:
unique(boolean)

identifier

public T identifier(boolean identifier)
Set whether the property value is an identifier.

Note that this is only applicable to contexts where a collection of the data is stored an that identification can apply against the other entries. In a singular context, identification is meaningless.

Parameters:
identifier - true when the value is an identifier; or false when it isn't.
Returns:
this ConstrainedProperty
Since:
1.0
See Also:
isIdentifier()

setIdentifier

public void setIdentifier(boolean identifier)
Set whether the property value is an identifier.

Since:
1.0
See Also:
identifier(boolean)

isIdentifier

public boolean isIdentifier()
Retrieves whether the property is an identifier.

Returns:
true when the property is an identifier; or

false it isn't.

Since:
1.0
See Also:
identifier(boolean)

editable

public T editable(boolean editable)

setEditable

public void setEditable(boolean editable)

isEditable

public boolean isEditable()

persistent

public T persistent(boolean persistent)

setPersistent

public void setPersistent(boolean persistent)

isPersistent

public boolean isPersistent()

saved

public T saved(boolean saved)

setSaved

public void setSaved(boolean saved)

isSaved

public boolean isSaved()

displayedRaw

public T displayedRaw(boolean displayedRaw)

setDisplayedRaw

public void setDisplayedRaw(boolean displayedRaw)

isDisplayedRaw

public boolean isDisplayedRaw()

hasLimitedLength

public boolean hasLimitedLength()

hasMixLength

public boolean hasMixLength()

hasMaxLength

public boolean hasMaxLength()

minLength

public T minLength(int minLength)

setMinLength

public void setMinLength(int minLength)

getMinLength

public int getMinLength()

maxLength

public T maxLength(int maxLength)

setMaxLength

public void setMaxLength(int maxLength)

getMaxLength

public int getMaxLength()

hasPrecision

public boolean hasPrecision()

precision

public T precision(int precision)

setPrecision

public void setPrecision(int precision)

getPrecision

public int getPrecision()

hasScale

public boolean hasScale()

scale

public T scale(int scale)

setScale

public void setScale(int scale)

getScale

public int getScale()

regexp

public T regexp(String regexp)

setRegexp

public void setRegexp(String regexp)

getRegexp

public String getRegexp()

matchesRegexp

public boolean matchesRegexp()

email

public T email(boolean email)

setEmail

public void setEmail(boolean email)

isEmail

public boolean isEmail()

url

public T url(boolean url)

setUrl

public void setUrl(boolean url)

isUrl

public boolean isUrl()

minDate

public T minDate(Date minDate)

setMinDate

public void setMinDate(Date minDate)

getMinDate

public Date getMinDate()

maxDate

public T maxDate(Date maxDate)

setMaxDate

public void setMaxDate(Date maxDate)

getMaxDate

public Date getMaxDate()

isLimitedDate

public boolean isLimitedDate()

inList

public T inList(String... inList)

setInList

public void setInList(String... inList)

inList

public T inList(int... inList)

setInList

public void setInList(int... inList)

inList

public T inList(byte... inList)

setInList

public void setInList(byte... inList)

inList

public T inList(char... inList)

setInList

public void setInList(char... inList)

inList

public T inList(short... inList)

setInList

public void setInList(short... inList)

inList

public T inList(long... inList)

setInList

public void setInList(long... inList)

inList

public T inList(float... inList)

setInList

public void setInList(float... inList)

inList

public T inList(double... inList)

setInList

public void setInList(double... inList)

inList

public T inList(Collection inList)

setInList

public void setInList(Collection inList)

getInList

public String[] getInList()

isInList

public boolean isInList()

rangeBegin

public T rangeBegin(byte value)

rangeBegin

public T rangeBegin(char value)

rangeBegin

public T rangeBegin(short value)

rangeBegin

public T rangeBegin(int value)

rangeBegin

public T rangeBegin(long value)

rangeBegin

public T rangeBegin(float value)

rangeBegin

public T rangeBegin(double value)

rangeBegin

public T rangeBegin(Comparable value)

setRangeBegin

public void setRangeBegin(byte value)

setRangeBegin

public void setRangeBegin(char value)

setRangeBegin

public void setRangeBegin(short value)

setRangeBegin

public void setRangeBegin(int value)

setRangeBegin

public void setRangeBegin(long value)

setRangeBegin

public void setRangeBegin(float value)

setRangeBegin

public void setRangeBegin(double value)

setRangeBegin

public void setRangeBegin(Comparable rangeBegin)

getRangeBegin

public Comparable getRangeBegin()

rangeEnd

public T rangeEnd(char value)

rangeEnd

public T rangeEnd(byte value)

rangeEnd

public T rangeEnd(double value)

rangeEnd

public T rangeEnd(float value)

rangeEnd

public T rangeEnd(int value)

rangeEnd

public T rangeEnd(long value)

rangeEnd

public T rangeEnd(short value)

rangeEnd

public T rangeEnd(Comparable value)

setRangeEnd

public void setRangeEnd(byte value)

setRangeEnd

public void setRangeEnd(char value)

setRangeEnd

public void setRangeEnd(short value)

setRangeEnd

public void setRangeEnd(int value)

setRangeEnd

public void setRangeEnd(long value)

setRangeEnd

public void setRangeEnd(float value)

setRangeEnd

public void setRangeEnd(double value)

setRangeEnd

public void setRangeEnd(Comparable rangeEnd)

getRangeEnd

public Comparable getRangeEnd()

isRange

public boolean isRange()

defaultValue

public T defaultValue(boolean value)

defaultValue

public T defaultValue(char value)

defaultValue

public T defaultValue(byte value)

defaultValue

public T defaultValue(short value)

defaultValue

public T defaultValue(int value)

defaultValue

public T defaultValue(long value)

defaultValue

public T defaultValue(float value)

defaultValue

public T defaultValue(double value)

defaultValue

public T defaultValue(Object value)

setDefaultValue

public void setDefaultValue(Object value)

getDefaultValue

public Object getDefaultValue()

hasDefaultValue

public boolean hasDefaultValue()

sameAs

public T sameAs(String reference)

setSameAs

public void setSameAs(String reference)

getSameAs

public String getSameAs()

isSameAs

public boolean isSameAs()

setManyToOne

public void setManyToOne()

setManyToOne

public void setManyToOne(Class klass)

setManyToOne

public void setManyToOne(Class klass,
                         String columnReference)

setManyToOne

public void setManyToOne(String table,
                         String columnReference)

setManyToOne

public void setManyToOne(Class klass,
                         String columnReference,
                         CreateTable.ViolationAction onUpdate,
                         CreateTable.ViolationAction onDelete)

setManyToOne

public void setManyToOne(String table,
                         String columnReference,
                         CreateTable.ViolationAction onUpdate,
                         CreateTable.ViolationAction onDelete)

getManyToOne

public ConstrainedProperty.ManyToOne getManyToOne()

manyToOne

public T manyToOne()

manyToOne

public T manyToOne(Class klass)

manyToOne

public T manyToOne(Class klass,
                   String columnReference)

manyToOne

public T manyToOne(String table,
                   String columnReference)

manyToOne

public T manyToOne(Class klass,
                   String columnReference,
                   CreateTable.ViolationAction onUpdate,
                   CreateTable.ViolationAction onDelete)

manyToOne

public T manyToOne(String table,
                   String columnReference,
                   CreateTable.ViolationAction onUpdate,
                   CreateTable.ViolationAction onDelete)

hasManyToOne

public boolean hasManyToOne()

setManyToOneAssociation

public void setManyToOneAssociation()

setManyToOneAssociation

public void setManyToOneAssociation(String property)

setManyToOneAssociation

public void setManyToOneAssociation(Class klass,
                                    String property)

getManyToOneAssociation

public ConstrainedProperty.ManyToOneAssociation getManyToOneAssociation()

manyToOneAssociation

public T manyToOneAssociation()

manyToOneAssociation

public T manyToOneAssociation(String property)

manyToOneAssociation

public T manyToOneAssociation(Class klass,
                              String property)

hasManyToOneAssociation

public boolean hasManyToOneAssociation()

setManyToMany

public void setManyToMany()

setManyToMany

public void setManyToMany(Class klass)

setManyToMany

public void setManyToMany(CreateTable.ViolationAction onUpdate,
                          CreateTable.ViolationAction onDelete)

setManyToMany

public void setManyToMany(Class klass,
                          CreateTable.ViolationAction onUpdate,
                          CreateTable.ViolationAction onDelete)

getManyToMany

public ConstrainedProperty.ManyToMany getManyToMany()

manyToMany

public T manyToMany()

manyToMany

public T manyToMany(Class klass)

manyToMany

public T manyToMany(CreateTable.ViolationAction onUpdate,
                    CreateTable.ViolationAction onDelete)

manyToMany

public T manyToMany(Class klass,
                    CreateTable.ViolationAction onUpdate,
                    CreateTable.ViolationAction onDelete)

hasManyToMany

public boolean hasManyToMany()

setManyToManyAssociation

public void setManyToManyAssociation()

setManyToManyAssociation

public void setManyToManyAssociation(String property)

setManyToManyAssociation

public void setManyToManyAssociation(Class klass,
                                     String property)

getManyToManyAssociation

public ConstrainedProperty.ManyToManyAssociation getManyToManyAssociation()

manyToManyAssociation

public T manyToManyAssociation()

manyToManyAssociation

public T manyToManyAssociation(String property)

manyToManyAssociation

public T manyToManyAssociation(Class klass,
                               String property)

hasManyToManyAssociation

public boolean hasManyToManyAssociation()

format

public T format(Format format)

setFormat

public void setFormat(Format format)

getFormat

public Format getFormat()

isFormatted

public boolean isFormatted()

file

public T file(boolean file)

setFile

public void setFile(boolean file)

isFile

public boolean isFile()

sparse

public T sparse(boolean sparse)

setSparse

public void setSparse(boolean sparse)

isSparse

public boolean isSparse()

listed

public T listed(boolean listed)
Sets whether the property should be included in data lists.

This is not actually used by the CMF itself, but is very useful when integrating with automatic user interface generation libraries.

Parameters:
listed - true if the property should be listed; or

false if it shouldn't

Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
setListed(boolean), isListed()

setListed

public void setListed(boolean listed)
Sets whether the property should be included in data lists.

Parameters:
listed - true if the property should be listed; or

false if it shouldn't

Since:
1.0
See Also:
listed(boolean), isListed()

isListed

public boolean isListed()
Retrieves whether the property should be included in data lists.

Returns:
true if the property should be listed; or

false if it shouldn't

Since:
1.0
See Also:
listed(boolean), setListed(boolean)

position

public T position(int position)
Sets the position in which the property should be displayed.

This is not actually used by the CMF itself, but is very useful when integrating with automatic user interface generation libraries.

Parameters:
position - an integer value with the position; or

-1 if the property shouldn't be positioned

Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
setPosition(int), hasPosition(), getPosition()

setPosition

public void setPosition(int position)
Sets the position in which the property should be displayed.

Parameters:
position - an integer value with the position; or

-1 if the property shouldn't be positioned

Since:
1.0
See Also:
position(int), hasPosition(), getPosition()

hasPosition

public boolean hasPosition()
Indicates whether the position of the property is set.

Returns:
true if the property has a position; or

false if it hasn't

Since:
1.0
See Also:
position(int), setPosition(int), getPosition()

getPosition

public int getPosition()
Retrieves the position in which the property should be displayed.

Returns:
an integer value with the position; or

-1 if the property shouldn't be positioned

Since:
1.0
See Also:
position(int), setPosition(int), hasPosition()

mimeType

public T mimeType(MimeType mimeType)
Sets the mime type of the property.

Setting this constraint will make the ContentQueryManager automatically store the data in this property in the content management back-end. This column will not be stored in a regular database table. All this is handled transparently and automatically.

Parameters:
mimeType - the MimeType of the property
Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
setMimeType(MimeType), hasMimeType(), getMimeType()

setMimeType

public void setMimeType(MimeType mimeType)
Sets the mime type of the property.

Parameters:
mimeType - the MimeType of the property
Since:
1.0
See Also:
mimeType(MimeType), hasMimeType(), getMimeType()

hasMimeType

public boolean hasMimeType()
Indicates whether the property has a mime type.

Returns:
true if the property has a mime type; or

false if it hasn't

Since:
1.0
See Also:
mimeType(MimeType), setMimeType(MimeType), getMimeType()

getMimeType

public MimeType getMimeType()
Retrieves the mime type of the property.

Returns:
the mime type of the property; or

null if the property has no mime type

Since:
1.0
See Also:
mimeType(MimeType), setMimeType(MimeType), hasMimeType()

autoRetrieved

public T autoRetrieved(boolean autoRetrieved)
Sets whether the content data of this property should be retrieved automatically from the back-end.

This is only useful when the property also has a mime type constraint.

It's not recommended to enable this constraint for large data since everything will be stored in memory, only use this for text snippets or something relatively small.

Parameters:
autoRetrieved - true if the data should be automatically retrieved; or

false otherwise

Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
mimeType(MimeType), setAutoRetrieved(boolean), isAutoRetrieved()

setAutoRetrieved

public void setAutoRetrieved(boolean autoRetrieved)
Sets whether the content data of this property should be retrieved automatically from the back-end.

Parameters:
autoRetrieved - true if the data should be automatically retrieved; or

false otherwise

Since:
1.0
See Also:
autoRetrieved(boolean), isAutoRetrieved()

isAutoRetrieved

public boolean isAutoRetrieved()
Indicates whether the content data of this property is automatically retrieved from the back-end.

Returns:
true if the data should be automatically retrieved; or

false otherwise

Since:
1.0
See Also:
autoRetrieved(boolean), setAutoRetrieved(boolean)

fragment

public T fragment(boolean fragment)
Sets whether the content data of this property is a fragment.

This is only useful when the property also has a mime type constraint. A fragment means that it's not a complete document or a file, but rather a small part that is intended to be used within a larger document. For example a HTML snippet. This information is for example important when validating the data.

Parameters:
fragment - true if the content is a fragment; or

false otherwise

Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
mimeType(MimeType), setFragment(boolean), isFragment()

setFragment

public void setFragment(boolean fragment)
Sets whether the content data of this property is a fragment.

Parameters:
fragment - true if the content is a fragment; or

false otherwise

Since:
1.0
See Also:
fragment(boolean), isFragment()

isFragment

public boolean isFragment()
Indicates whether the content data of this property is a fragment.

Returns:
true if the content is a fragment; or

false otherwise

Since:
1.0
See Also:
fragment(boolean), setFragment(boolean)

name

public T name(String name)
Sets the name of the content data of this property.

This is only useful when the property also has a mime type constraint.

Parameters:
name - the name
Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
mimeType(MimeType), setName(String), getName(), hasName()

setName

public void setName(String name)
Sets the name of the content data of this property.

Parameters:
name - the name
Since:
1.0
See Also:
name(String), getName(), hasName()

getName

public String getName()
Retrieves the name of this property.

Returns:
null if the content data has no name; or

the name of the content

Since:
1.0
See Also:
name(String), setName(String), hasName()

hasName

public boolean hasName()
Indicates whether this property has a name.

Returns:
true if the property has a name; or

false otherwise

Since:
1.0
See Also:
name(String), setName(String), getName()

repository

public T repository(String repository)
Sets the repository where the content data of this property will be stored.

This is only useful when the property also has a mime type constraint.

Parameters:
repository - the repository
Returns:
the current CmrProperty instance
Since:
1.0
See Also:
mimeType(MimeType), setRepository(String), getRepository(), hasRepository()

setRepository

public void setRepository(String repository)
Sets the repository where the content data of this property will be stored.

Parameters:
repository - the repository
Since:
1.0
See Also:
repository(String), getRepository(), hasRepository()

getRepository

public String getRepository()
Retrieves the repository where the content data of this property will be stored.

Returns:
null if no repository has been specified; or

the name of the repository

Since:
1.0
See Also:
repository(String), setRepository(String), hasRepository()

hasRepository

public boolean hasRepository()
Indicates whether this property will be stored in another repository than the default repository.

Returns:
true if the property will be stored in another repository; or

false otherwise

Since:
1.0
See Also:
repository(String), setRepository(String), getRepository()

ordinal

public T ordinal(boolean ordinal)
Sets whether this property has to be used as an ordinal.

The value of this property will be handled in the back-end by an OrdinalManager. It will also enable the move, up and down methods in the ContentQueryManager to easily reorder data rows in the back-end.

Parameters:
ordinal - true if this property is an ordinal; or

false otherwise

Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
ordinal(boolean, String), setOrdinal(boolean), setOrdinal(boolean, String), isOrdinal()

ordinal

public T ordinal(boolean ordinal,
                 String restriction)
Sets whether this property has to be used as an ordinal with a restricting column.

Parameters:
ordinal - true if this property is an ordinal; or

false otherwise

restriction - the name of the restricting column
Returns:
the current ConstrainedProperty instance
Since:
1.0
See Also:
ordinal(boolean), setOrdinal(boolean), setOrdinal(boolean, String), isOrdinal(), hasOrdinalRestriction(), getOrdinalRestriction()

setOrdinal

public void setOrdinal(boolean ordinal)
Sets whether this property has to be used as an ordinal.

Parameters:
ordinal - true if this property is an ordinal; or

false otherwise

Since:
1.0
See Also:
ordinal(boolean), ordinal(boolean, String), setOrdinal(boolean, String), isOrdinal()

setOrdinal

public void setOrdinal(boolean ordinal,
                       String restriction)
Sets whether this property has to be used as an ordinal with a restricting column.

Parameters:
ordinal - true if this property is an ordinal; or

false otherwise

restriction - the name of the restricting column
Since:
1.0
See Also:
ordinal(boolean), ordinal(boolean, String), setOrdinal(boolean), isOrdinal(), hasOrdinalRestriction(), getOrdinalRestriction()

isOrdinal

public boolean isOrdinal()
Indicates whether this property has to be used as an ordinal.

Returns:
true if this property is an ordinal; or

false otherwise

Since:
1.0
See Also:
ordinal(boolean), ordinal(boolean, String), setOrdinal(boolean), setOrdinal(boolean, String)

hasOrdinalRestriction

public boolean hasOrdinalRestriction()
Indicates whether this property has an ordinal restricting column.

Returns:
true if this property has an ordinal restricting column; or

false otherwise

Since:
1.0
See Also:
ordinal(boolean, String), setOrdinal(boolean, String), getOrdinalRestriction()

getOrdinalRestriction

public String getOrdinalRestriction()
Retrieves the ordinal restriction of this property.

Returns:
the name of the ordinal restricting column; or

null if no ordinal restricting column has been defined

Since:
1.0
See Also:
ordinal(boolean, String), setOrdinal(boolean, String), hasOrdinalRestriction()

contentAttribute

public T contentAttribute(String name,
                          boolean value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          char value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          byte value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          short value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          int value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          long value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          float value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          double value)
Sets a named content attribute for this property that will be converted internally to a String value.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
contentAttribute(String, String), getContentAttributes()

contentAttribute

public T contentAttribute(String name,
                          String value)
Sets a named content attribute for this property.

This is only useful when the property also has a mime type constraint.

A content attribute provides additional meta data about how you want to store the content data after loading, this can for example be image dimensions.

Parameters:
name - the name of the attribute
value - the value of the attribute
Returns:
the current Content instance
Since:
1.0
See Also:
mimeType(MimeType), getContentAttributes()

getContentAttributes

public Map<String,String> getContentAttributes()
Retrieves the map of named content attributes for this property.

Returns:
the map of named content attributes; or

null if no attributes are present

Since:
1.0
See Also:
contentAttribute(String, String)

transformer

public T transformer(ContentTransformer transformer)
Sets a content transformer for this property.

This is only useful when the property also has a mime type constraint.

Parameters:
transformer - the content transformer
Returns:
the current Content instance
Since:
1.0
See Also:
mimeType(MimeType), setTransformer(ContentTransformer), hasTransformer(), getTransformer()

setTransformer

public void setTransformer(ContentTransformer transformer)
Sets a content transformer for this property.

Parameters:
transformer - the content transformer
Since:
1.0
See Also:
mimeType(MimeType), transformer(ContentTransformer), hasTransformer(), getTransformer()

hasTransformer

public boolean hasTransformer()
Indicates whether this property has a content transformer.

Returns:
true if this property has a content transformer; or

false otherwise

Since:
1.0
See Also:
transformer(ContentTransformer), setTransformer(ContentTransformer), getTransformer()

getTransformer

public ContentTransformer getTransformer()
Retrieves the content transformer of this property.

Returns:
the requested content transformer; or

null if no content transformer has been defined

Since:
1.0
See Also:
transformer(ContentTransformer), setTransformer(ContentTransformer), hasTransformer()

setCachedLoadedData

public void setCachedLoadedData(Object data)
Sets the cached loaded data.

This is used internally and should never be used explicitly by a developer, see Content.cachedLoadedData(Object) for more information.

Parameters:
data - the loaded data
Since:
1.0
See Also:
getCachedLoadedData()

getCachedLoadedData

public Object getCachedLoadedData()
Retrieves the cached loaded content data.

Returns:
the cached loaded content data; or

null if no loaded content data has been cached

Since:
1.0
See Also:
setCachedLoadedData(Object)

setConstraint

public void setConstraint(String name,
                          Object constraintData)
Sets the data of a particular constraint in a generic fashion.

Note that it's not recommended to use this to set any of the standard constraints since none of the additional logic and checks are executed.

Since:
1.4
See Also:
constraint(java.lang.String, java.lang.Object), getConstraint(java.lang.String), getConstraints()

constraint

public T constraint(String name,
                    Object constraintData)
Sets the data of a particular constraint in a generic fashion.

Note that it's not recommended to use this to set any of the standard constraints since none of the additional logic and checks are executed.

Returns:
the current Content instance
Since:
1.4
See Also:
setConstraint(java.lang.String, java.lang.Object), getConstraint(java.lang.String), getConstraints()

getConstraint

public Object getConstraint(String name)
Retrieves the value of a particular constraint in a generic fashion

Returns:
the data of a particular constraint; or

null if nothing has been registered for that constraint

Since:
1.4
See Also:
setConstraint(java.lang.String, java.lang.Object), constraint(java.lang.String, java.lang.Object), getConstraints()

getConstraints

public Map<String,Object> getConstraints()
Retrieves the map of all the constraints.

Returns:
the map with all the registered constraints
Since:
1.4
See Also:
setConstraint(java.lang.String, java.lang.Object), constraint(java.lang.String, java.lang.Object), getConstraint(java.lang.String)

clone

public ConstrainedProperty clone()
Overrides:
clone in class Object


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.