Search in sources :

Example 1 with PropertyClassInterface

use of com.xpn.xwiki.objects.classes.PropertyClassInterface in project xwiki-platform by xwiki.

the class PropertyMetaClass method newObject.

/**
 * {@inheritDoc}
 * <p>
 * This method is deprecated. Use directly the {@link PropertyClassProvider} if you need a new XClass property
 * instance.
 * </p>
 */
@Override
public BaseCollection newObject(XWikiContext context) throws XWikiException {
    PropertyClassInterface instance = null;
    try {
        // Try to use the corresponding XClass property provider to create the new property instance.
        PropertyClassProvider provider = Utils.getComponent(PropertyClassProvider.class, getName());
        instance = provider.getInstance();
    } catch (Exception e) {
    // Fail silently.
    }
    return instance != null && instance instanceof BaseCollection ? (BaseCollection) instance : super.newObject(context);
}
Also used : PropertyClassInterface(com.xpn.xwiki.objects.classes.PropertyClassInterface) PropertyClassProvider(com.xpn.xwiki.internal.objects.classes.PropertyClassProvider) BaseCollection(com.xpn.xwiki.objects.BaseCollection) XWikiException(com.xpn.xwiki.XWikiException)

Aggregations

XWikiException (com.xpn.xwiki.XWikiException)1 PropertyClassProvider (com.xpn.xwiki.internal.objects.classes.PropertyClassProvider)1 BaseCollection (com.xpn.xwiki.objects.BaseCollection)1 PropertyClassInterface (com.xpn.xwiki.objects.classes.PropertyClassInterface)1