com.xpn.xwiki.api
Class PropertyClass

java.lang.Object
  extended by com.xpn.xwiki.api.Api
      extended by com.xpn.xwiki.api.Element
          extended by com.xpn.xwiki.api.Collection
              extended by com.xpn.xwiki.api.PropertyClass
All Implemented Interfaces:
Comparable<PropertyClass>

public class PropertyClass
extends Collection
implements Comparable<PropertyClass>

XProperty definition API.

A property definition is the instantiation of a PropertyMetaClass for a particular Object definition (XClass), that customizes a property type to suit the needs of the class. For example, it can set the number type for a NumberClass, the list of possible values for a StaticListClass, etc.


Field Summary
 
Fields inherited from class com.xpn.xwiki.api.Element
element
 
Fields inherited from class com.xpn.xwiki.api.Api
context
 
Constructor Summary
PropertyClass(PropertyClass property, XWikiContext context)
          Default API constructor that creates a wrapper for a PropertyClass, given a context.
 
Method Summary
 int compareTo(PropertyClass other)
          Compares two property definitions based on their index number.
protected  PropertyClass getBasePropertyClass()
          Internal access to the wrapped PropertyClass.
 String getClassName()
          Get the name of the XClass (Object Definition) this property definition belongs to.
 String getClassType()
          Get the full name of the actual class of the wrapped PropertyClass.
 List<String> getListValues()
          If the property is a ListClass, returns the possible values.
 Map<String,ListItem> getMapValues()
          If the property is a ListClass, returns the possible values as a map internal key <-> displayed value.
 String getPrettyName()
          Get the untranslated user-friendly name of this property.
 PropertyClass getPropertyClass()
          Provides access to the wrapped PropertyClass if Programming Rights are present.
 String getTooltip()
          Get a tooltip string that should be displayed for input fields for instances of this property definition.
 String getType()
          Get the actual type of the wrapped PropertyClass.
 String getValidationMessage()
          Get the message that should be displayed when a value for an instance of this property definition fails the validation.
 String getValidationRegExp()
          Get the regular expression used for validating a value for an instance of this property definition.
 boolean isDisabled()
          See if this property is disabled or not.
 
Methods inherited from class com.xpn.xwiki.api.Collection
getCollection, getName, getNumber, getProperties, getProperty, getPropertyNames, getxWikiClass
 
Methods inherited from class com.xpn.xwiki.api.Element
getBaseElement
 
Methods inherited from class com.xpn.xwiki.api.Api
convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyClass

public PropertyClass(PropertyClass property,
                     XWikiContext context)
Default API constructor that creates a wrapper for a PropertyClass, given a context.

Parameters:
property - the property definition to wrap
context - the current request context
Method Detail

getBasePropertyClass

protected PropertyClass getBasePropertyClass()
Internal access to the wrapped PropertyClass.

Returns:
the wrapped property definition

getClassType

public String getClassType()
Get the full name of the actual class of the wrapped PropertyClass. The returned value is the canonical class name of the runtime object representing this property definition, for example com.xpn.xwiki.objects.classes.StringClass.

Returns:
the canonical class name of the wrapped property definition
See Also:
{@code getType()} for a more user-friendly type

getType

public String getType()
Get the actual type of the wrapped PropertyClass. The returned value is extracted from the class name of the runtime object representing this property definition, and denotes a user-friendly data type name, for example StringClass, NumberClass or StaticListClass.

Returns:
the type of this property definition
See Also:
{@code getClassType()} for a more formal type

getClassName

public String getClassName()
Get the name of the XClass (Object Definition) this property definition belongs to. For example, XWiki.XWikiUsers or Blog.BlogPostClass.

Returns:
the name of the owner XClass

getPropertyClass

@Programming
public PropertyClass getPropertyClass()
Provides access to the wrapped PropertyClass if Programming Rights are present.

Returns:
the wrapped property definition

getPrettyName

public String getPrettyName()
Get the untranslated user-friendly name of this property. For example, User type instead of the internal usertype.

Overrides:
getPrettyName in class Collection
Returns:
the configured pretty name of this property definition
See Also:
{@code getName()} returns the actual property name

getValidationMessage

public String getValidationMessage()
Get the message that should be displayed when a value for an instance of this property definition fails the validation. For example, Please enter a valid IP address.

Returns:
the configured validation message
See Also:
{@code getValidationRegExp()} returns the regular expression used for validating the property value

getValidationRegExp

public String getValidationRegExp()
Get the regular expression used for validating a value for an instance of this property definition.

Returns:
a string representation of the validation regular expression
See Also:
{@code getValidationMessage()} returns the message that should be displayed in case the validation failed

getTooltip

public String getTooltip()
Get a tooltip string that should be displayed for input fields for instances of this property definition.

Returns:
A raw tooltip string. The value does not escape special HTML characters, so the caller should manually escape quotes if the tooltip should be used as a value for the HTML title attribute.

isDisabled

public boolean isDisabled()
See if this property is disabled or not. A disabled property should not be editable, but existing object values are still kept in the database.

Returns:
true if this property is disabled and should not be used, false otherwise
Since:
2.4M2

getListValues

public List<String> getListValues()
If the property is a ListClass, returns the possible values. These are the internal values (keys), and not the user-friendly or translated values that would be displayed to the user.

Returns:
the list of possible (String) values
See Also:
{@code getMapValues()} returns both the keys and their user-friendly displayed values

getMapValues

public Map<String,ListItem> getMapValues()
If the property is a ListClass, returns the possible values as a map internal key <-> displayed value.

Returns:
the map of possible (String) values and their associated (ListItem) displayed values
See Also:
{@code getListValues()} returns only the list of possible internal keys

compareTo

public int compareTo(PropertyClass other)
Compares two property definitions based on their index number.

Specified by:
compareTo in interface Comparable<PropertyClass>
Parameters:
other - the other property definition to be compared with
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Since:
2.4M2
See Also:
Collection.getNumber()