public final class CmsJspContentAccessValueWrapper
extends java.lang.Object
The implementation is optimized for performance and uses lazy initializing of the requested values as much as possible.
CmsJspContentAccessBean
,
CmsJspTagContentAccess
限定符和类型 | 类和说明 |
---|---|
class |
CmsJspContentAccessValueWrapper.CmsHasValueTransformer
Provides a Map with Booleans that
indicate if a nested sub value (xpath) for the current value is available in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsRdfaTransformer
Provides a Map which lets the user a nested sub value from the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsSubValueListTransformer
Provides a Map which lets the user access nested sub value Lists directly below the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsValueListTransformer
Provides a Map which lets the user access nested sub value Lists from the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsValueTransformer
Provides a Map which lets the user a nested sub value from the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsXmlValueTransformer
Provides a Map which lets the user directly access sub-nodes of the XML represented by the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
限定符和类型 | 字段和说明 |
---|---|
protected static CmsJspContentAccessValueWrapper |
NULL_VALUE_WRAPPER
Constant for the null (non existing) value.
|
限定符和类型 | 方法和说明 |
---|---|
protected java.lang.String |
createPath(java.lang.Object input)
Returns the path to the XML content based on the current element path.
|
static CmsJspContentAccessValueWrapper |
createWrapper(CmsObject cms,
I_CmsXmlContentValue value)
Factory method to create a new XML content value wrapper.
|
boolean |
equals(java.lang.Object obj) |
boolean |
getExists()
Returns
true in case this value actually exists in the XML content it was requested from. |
java.util.Map<java.lang.String,java.lang.Boolean> |
getHasValue()
Returns a lazy initialized Map that provides Booleans that
indicate if a nested sub value (xpath) for the current value is available in the XML content.
|
int |
getIndex()
Returns the node index of the XML content value in the source XML document,
starting with 0.
|
boolean |
getIsEmpty()
Returns
true in case the value is empty, that is either null or an empty String. |
boolean |
getIsEmptyOrWhitespaceOnly()
Returns
true in case the value is empty or whitespace only,
that is either null or String that contains only whitespace chars. |
boolean |
getIsSet()
Returns
true in case the value is set in the content,
i.e. the value exists and is not empty or whitespace only. |
java.util.Locale |
getLocale()
Returns the Locale of the current XML content value.
|
java.lang.String |
getName()
Returns the xml node name of the wrapped content value.
|
java.util.List<java.lang.String> |
getNames()
Returns a list that provides the names of all nested sub values
directly below the current value from the XML content, including the index.
|
java.lang.String |
getPath()
Returns the path to the current XML content value.
|
java.util.Map<java.lang.String,java.lang.String> |
getRdfa()
Returns a lazy initialized Map that provides the RDFA for nested sub values.
|
java.lang.String |
getRdfaAttr()
Returns the RDF annotation to this content value.
|
CmsJspContentAccessValueWrapper |
getResolve()
Short form of
getResolveMacros() . |
CmsJspContentAccessValueWrapper |
getResolveMacros()
Turn on macro resolving for the wrapped value.
|
java.lang.String |
getStringValue()
Returns the String value of the wrapped content value.
|
java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> |
getSubValueList()
Returns a lazy initialized Map that provides the Lists of sub values directly below
the current value from the XML content.
|
java.lang.String |
getTypeName()
Returns the schema type name of the wrapped content value.
|
java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> |
getValue()
Returns a lazy initialized Map that provides the nested sub values
for the current value from the XML content.
|
java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> |
getValueList()
Returns a lazy initialized Map that provides the Lists of nested sub values
for the current value from the XML content.
|
java.util.Map<java.lang.String,java.lang.String> |
getXmlText()
Returns a lazy initialized Map that provides direct access to the XML element
for the current value from the XML content.
|
int |
hashCode() |
CmsObject |
obtainCmsObject()
Returns the wrapped OpenCms user context.
|
I_CmsXmlContentValue |
obtainContentValue()
Returns the wrapped content value.
|
java.lang.String |
toString() |
protected static final CmsJspContentAccessValueWrapper NULL_VALUE_WRAPPER
public static CmsJspContentAccessValueWrapper createWrapper(CmsObject cms, I_CmsXmlContentValue value)
In case either parameter is null
, the NULL_VALUE_WRAPPER
is returned.
cms
- the current users OpenCms contextvalue
- the value to warpnull
if any parameter is null
public boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
Object.equals(java.lang.Object)
public boolean getExists()
true
in case this value actually exists in the XML content it was requested from.Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].exists}" > The content has a "Link" value! </c:if> </cms:contentload>
true
in case this value actually exists in the XML content it was requested frompublic java.util.Map<java.lang.String,java.lang.Boolean> getHasValue()
The provided Map key is assumed to be a String that represents the relative xpath to the value.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsConstantMap.CONSTANT_BOOLEAN_FALSE_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].hasValue['Description']}" > The content has a "Description" value as sub element to the "Link" value! </c:if> </cms:contentload>Please note that you can also test if a sub-value exists like this:
<c:if test="${content.value['Link'].value['Description'].exists}" > ... </c:if>
public int getIndex()
In case the XML content value does not exist, -1
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The locale of the Link node: ${content.value['Link'].locale} </cms:contentload>
public boolean getIsEmpty()
true
in case the value is empty, that is either null
or an empty String.
In case the XML content value does not exist, true
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].isEmpty}" > The content of the "Link" value is empty. </c:if> </cms:contentload>
true
in case the value is emptypublic boolean getIsEmptyOrWhitespaceOnly()
true
in case the value is empty or whitespace only,
that is either null
or String that contains only whitespace chars.
In case the XML content value does not exist, true
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].isEmptyOrWhitespaceOnly}" > The content of the "Link" value is empty or contains only whitespace chars. </c:if> </cms:contentload>
true
in case the value is empty or whitespace onlypublic boolean getIsSet()
true
in case the value is set in the content,
i.e. the value exists and is not empty or whitespace only.
In case the XML content value does exist and has a non empty value, true
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].isSet}" > The content of the "Link" value is not empty. </c:if> </cms:contentload>
true
in case the value is setpublic java.util.Locale getLocale()
In case the XML content value does not exist, the OpenCms system default Locale is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The locale of the Link node: ${content.value['Link'].locale} </cms:contentload>
public java.lang.String getName()
I_CmsXmlSchemaType.getName()
public java.util.List<java.lang.String> getNames()
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach items="${content.value['Items'].names}" var="elem"> <c:out value="${elem}" /> </c:forEach> </cms:contentload>
public java.lang.String getPath()
In case the XML content value does not exist, an empty String ""
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The path to the Link node in the XML: ${content.value['Link'].path} </cms:contentload>
public java.util.Map<java.lang.String,java.lang.String> getRdfa()
The provided Map key is assumed to be a String that represents the relative xpath to the value.
public java.lang.String getRdfaAttr()
Use to insert the annotation attributes into a HTML tag.
Example using EL: <h1 ${value.Title.rdfaAttr}>${value.Title}</h1> will result in <h1 about="..." property="...">My title</h1>
public CmsJspContentAccessValueWrapper getResolve()
getResolveMacros()
.getResolveMacros()
public CmsJspContentAccessValueWrapper getResolveMacros()
Macro resolving is turned off by default.
When turned on, a macro resolver is initialized with
the current OpenCms user context and the URI of the current resource.
This means known macros contained in the wrapped value will be resolved when the output String is generated.
For example, a %(property.Title)
in the value would be replaced with the
value of the title property. Macros that can not be resolved will be kept.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The text with macros resolved: ${content.value['Text'].resolveMacros} </cms:contentload>
CmsMacroResolver
public java.lang.String getStringValue()
Note that this will return the empty String ""
when getExists()
returns false
.
toString()
public java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> getSubValueList()
The provided Map key is assumed to be a String that represents the relative xpath to the value. Use this method in case you want to iterate over a List of sub values from the XML content.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsConstantMap.CONSTANT_EMPTY_LIST_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="desc" items="${content.value['Link'].subValueList['Description']}"> ${desc} </c:forEach> </cms:contentload>
public java.lang.String getTypeName()
I_CmsXmlSchemaType.getTypeName()
public java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> getValue()
The provided Map key is assumed to be a String that represents the relative xpath to the value.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsJspContentAccessBean.CONSTANT_NULL_VALUE_WRAPPER_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The Link Description: ${content.value['Link'].value['Description']} </cms:contentload>Please note that this example will only work if the 'Link' element is mandatory in the schema definition of the XML content.
public java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> getValueList()
The provided Map key is assumed to be a String that represents the relative xpath to the value. Use this method in case you want to iterate over a List of values form the XML content.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsConstantMap.CONSTANT_EMPTY_LIST_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="desc" items="${content.value['Link'].valueList['Description']}"> ${desc} </c:forEach> </cms:contentload>
public java.util.Map<java.lang.String,java.lang.String> getXmlText()
public int hashCode()
hashCode
在类中 java.lang.Object
Object.hashCode()
public CmsObject obtainCmsObject()
Note that this will return null
when getExists()
returns false
.
public I_CmsXmlContentValue obtainContentValue()
Note that this will return null
when getExists()
returns false
. Method name does not start with "get" to prevent using it in the expression language.
public java.lang.String toString()
toString
在类中 java.lang.Object
Object.toString()
,
getStringValue()
protected java.lang.String createPath(java.lang.Object input)
This is used to create xpath information for sub-elements in the transformers.
input
- the additional path that is appended to the current path