Package com.xpn.xwiki.api
Class PropertyClass
- java.lang.Object
-
- com.xpn.xwiki.api.Api
-
- com.xpn.xwiki.api.Element
-
- com.xpn.xwiki.api.Collection
-
- 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 aNumberClass
, the list of possible values for aStaticListClass
, etc.- Version:
- $Id: c281fae27425f727d0d814c287b91721800b74e6 $
-
-
Constructor Summary
Constructors Constructor Description PropertyClass(PropertyClass property, XWikiContext context)
Default API constructor that creates a wrapper for aPropertyClass
, given acontext
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PropertyClass other)
Compares two property definitions based on their index number.protected PropertyClass
getBasePropertyClass()
Internal access to the wrappedPropertyClass
.String
getClassName()
Get the name of theXClass
(Object Definition) this property definition belongs to.String
getClassType()
Each type of XClass property is identified by a string that specifies the data type of the property value (e.g.String
getHint()
Get the translated hint string that should be displayed for input fields for instances of this property definition.List<String>
getListValues()
If the property is aListClass
, returns the possible values.Map<String,ListItem>
getMapValues()
If the property is aListClass
, returns the possible values as a mapinternal key <-> displayed value
.String
getPrettyName()
Get the untranslated user-friendly name of this property.PropertyClass
getPropertyClass()
Provides access to the wrappedPropertyClass
if Programming Rights are present.ClassPropertyReference
getReference()
String
getTooltip()
Get a tooltip string that should be displayed for input fields for instances of this property definition.String
getTranslatedPrettyName()
Get the translated user-friendly name of this property.String
getType()
Get the actual type of the wrappedPropertyClass
.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, getValue, getxWikiClass
-
Methods inherited from class com.xpn.xwiki.api.Element
getBaseElement, getDocumentReference
-
Methods inherited from class com.xpn.xwiki.api.Api
convert, convert, convert, convertAttachments, getAuthorizationManager, getContextualAuthorizationManager, getXWikiContext, hasAccess, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
-
-
-
-
Constructor Detail
-
PropertyClass
public PropertyClass(PropertyClass property, XWikiContext context)
Default API constructor that creates a wrapper for aPropertyClass
, given acontext
.- Parameters:
property
- the property definition to wrapcontext
- the current request context
-
-
Method Detail
-
getBasePropertyClass
protected PropertyClass getBasePropertyClass()
Internal access to the wrappedPropertyClass
.- Returns:
- the wrapped property definition
-
getReference
public ClassPropertyReference getReference()
- Overrides:
getReference
in classElement
- Returns:
- the reference of the element
-
getClassType
public String getClassType()
Each type of XClass property is identified by a string that specifies the data type of the property value (e.g. 'String', 'Number', 'Date') without disclosing implementation details. The internal implementation of an XClass property type can change over time but itsclassType
should not.The
classType
can be used as a hint to lookup various components related to this specific XClass property type or it can be used as a property name to retrieve the meta class of this property fromXWiki.getMetaclass()
.- Returns:
- an identifier for the data type of the property value (e.g. 'String', 'Number', 'Date')
-
getType
public String getType()
Get the actual type of the wrappedPropertyClass
. 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 exampleStringClass
,NumberClass
orStaticListClass
.- Returns:
- the type of this property definition
- See Also:
if you need the implementation hint of this property
-
getClassName
public String getClassName()
Get the name of theXClass
(Object Definition) this property definition belongs to. For example,XWiki.XWikiUsers
orBlog.BlogPostClass
.- Returns:
- the name of the owner XClass
-
getPropertyClass
@Programming public PropertyClass getPropertyClass()
Provides access to the wrappedPropertyClass
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 internalusertype
.- Overrides:
getPrettyName
in classCollection
- Returns:
- the configured pretty name of this property definition
- See Also:
returns the actual property name
-
getTranslatedPrettyName
public String getTranslatedPrettyName()
Get the translated user-friendly name of this property.- Returns:
- the configured pretty name of this property definition
- See Also:
returns the actual property name
-
getHint
public String getHint()
Get the translated hint string that should be displayed for input fields for instances of this property definition.- Returns:
- the hint string
- Since:
- 9.11RC1
-
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:
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:
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 aListClass
, 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:
returns both the keys and their user-friendly displayed values
-
getMapValues
public Map<String,ListItem> getMapValues()
If the property is aListClass
, returns the possible values as a mapinternal key <-> displayed value
.- Returns:
- the map of possible (
String
) values and their associated (ListItem
) displayed values - See Also:
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 interfaceComparable<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()
-
-