Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
Element | 32 | 5 | 0% | 4 | 4 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package com.xpn.xwiki.api; | |
21 | ||
22 | import org.xwiki.model.reference.EntityReference; | |
23 | ||
24 | import com.xpn.xwiki.XWikiContext; | |
25 | import com.xpn.xwiki.objects.BaseElement; | |
26 | ||
27 | /** | |
28 | * Element is a superclass for any XWiki Class, Object, or Property which might be stored in the database. | |
29 | * | |
30 | * @version $Id: 22a39ae10fc88905fcf76a58b2bd243f94b8702c $ | |
31 | */ | |
32 | public class Element extends Api | |
33 | { | |
34 | /** The internal element which this wraps. */ | |
35 | protected BaseElement element; | |
36 | ||
37 | /** | |
38 | * The Constructor. Create a new element wrapping the given internal BaseElement. | |
39 | * | |
40 | * @param element the internal BaseElement to wrap. | |
41 | * @param context the XWikiContext which may be used to get information about the current request. | |
42 | */ | |
43 | 102426 | public Element(BaseElement element, XWikiContext context) |
44 | { | |
45 | 102427 | super(context); |
46 | 102424 | this.element = element; |
47 | } | |
48 | ||
49 | /** | |
50 | * @return the internal BaseElement which this Element wraps. | |
51 | */ | |
52 | 0 | protected BaseElement getBaseElement() |
53 | { | |
54 | 0 | return this.element; |
55 | } | |
56 | ||
57 | /** | |
58 | * Get the name of this element. | |
59 | * If the Element is an XWiki {@link com.xpn.xwiki.api.Object} then it will be the name of the Document | |
60 | * containing the Object, if it's an XWiki {@link com.xpn.xwiki.api.Class} it will be the full name of the | |
61 | * {@link com.xpn.xwiki.api.Document} where the class is defined, if it's an XWiki | |
62 | * {@link com.xpn.xwiki.api.Property} then it will be the name of the property. | |
63 | * | |
64 | * @return the name of this Element. | |
65 | */ | |
66 | 58916 | public String getName() |
67 | { | |
68 | 58916 | return this.element.getName(); |
69 | } | |
70 | ||
71 | /** | |
72 | * @return the reference of the element | |
73 | * @since 7.3M1 | |
74 | */ | |
75 | 0 | public EntityReference getReference() |
76 | { | |
77 | 0 | return this.element.getReference(); |
78 | } | |
79 | } |