Class CmsJspContentAccessValueWrapper
- All Implemented Interfaces:
Iterable<String>
,Collection<String>
The implementation is optimized for performance and uses lazy initializing of the requested values as much as possible.
- Since:
- 7.0.2
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Provides a Map with Booleans that indicate if a nested sub value (xpath) for the current value is available in the XML content.class
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
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
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
Provides a Map which returns a nested sub value from the current value.class
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 class
The null value info, used to generate RDFA and DND annotations for null values. -
Field Summary
Modifier and TypeFieldDescriptionprotected CmsObject
The wrapped OpenCms user context.protected Optional<CmsJspLinkWrapper>
Cached link wrapper - use Optional to distinguish 'uncached' state from 'does not exist'.protected static final CmsJspContentAccessValueWrapper
Constant for the null (non existing) value.static final String
Attribute for used to cache the tree format of the XML content which is used to generate JSON. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
createPath
(Object input) Returns the path to the XML content based on the current element path.createWrapper
(CmsObject cms, I_CmsXmlContentValue value, I_CmsXmlDocument content, String valueName, Locale locale) Factory method to create a new XML content value wrapper.createWrapper
(CmsObject cms, I_CmsXmlContentValue value, I_CmsXmlContentValue parentValue, String valueName) Factory method to create a new XML content value wrapper.boolean
Returns the current cms context.Returns a lazy initialized Map that provides Booleans which indicate if if the wrapped values String representation contains a specific String.Returns the wrapped content value.boolean
Returnstrue
in case this value actually exists in the XML content it was requested from.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.Returns the annotation that enables image drag and drop for this content value.int
getIndex()
Returns the node index of the XML content value in the source XML document, starting with 0.boolean
Returnstrue
in case the value is empty, that is eithernull
or an empty String.boolean
Returnstrue
in case the value is empty or whitespace only, that is eithernull
or String that contains only whitespace chars.Returns a lazy initialized Map that provides Booleans which indicate if an Object is equal to the wrapped object.boolean
getIsSet()
Returnstrue
in case the wrapped value exists and is not empty or whitespace only.boolean
Returnstrue
in case the wrapped value exists, is not empty or whitespace only and is also not equal to the String'none'
.getJson()
Gets the default JSON representation of a value.Returns the Locale of the current XML content value.Calculates the next largest integer from the wrapped value.Calculates the next smallest integer from the wrapped value.Calculates the next integer from the wrapped value by rounding.getName()
Returns the xml node name of the wrapped content value.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.Returns the raw instance of the wrapped value.getPath()
Returns the path to the current XML content value.getRdfa()
Returns a lazy initialized Map that provides the RDFA for nested sub values.Returns the RDF annotation to this content value.Short form ofgetResolveMacros()
.Turn on macro resolving for the wrapped value.Deprecated.Assumes the wrapped value is a String and strips all HTML markup from this String.Returns a lazy initialized Map that provides the Lists of sub values directly below the current value from the XML content.boolean
Converts the wrapped value to a boolean.Tries to create a container page wrapper from the wrapped value.Converts the wrapped value to a date.Converts a date series configuration to a date series bean.Parses the wrapped value to a Double precision float.Parses the wrapped value to a Double precision float.Returns a scaled image bean from the wrapped value.Converts a date to an instance date bean.Parses the wrapped value to a Long integer.Converts the value to a link wrapper.Returns the substituted link to the wrapped value.Converts the wrapped value to a java.util.Locale instance using the locale manager.Parses the wrapped value to a Long integer.Transforms the current value into a parameter map.Returns the resource this value if pointing to.Returns the wrapped value as a String.Returns a lazy initialized map that provides trimmed to size strings of the wrapped object string value.Returns the schema type name of the wrapped content value.getValue()
Returns a lazy initialized Map that provides the nested sub values for the current value from the XML content.Returns a lazy initialized Map that provides the Lists of nested sub values for the current value from the XML content.Returns a lazy initialized Map that provides direct access to the XML element for the current value from the XML content.int
hashCode()
The hash code is created from the file structure id of the underlying XML content, the selected locale and the path to the node in the XML content.boolean
isEmpty()
Supports the use of theempty
operator in the JSP EL by implementing the Collection interface.boolean
Compares this value against a list of Strings and returnstrue
in case the list contains the toString representation of this value, or afalse
otherwise.iterator()
Supports the use of theempty
operator in the JSP EL by implementing the Collection interface.Deprecated.usegetCmsObject()
insteadDeprecated.usegetContentValue()
insteadint
size()
Supports the use of theempty
operator in the JSP EL by implementing the Collection interface.static String
substituteLink
(CmsObject cms, String target) Returns the substituted link to the given target.Parses the wrapped value to a Double precision float, returning the default in case the number can not be parsed.Parses the wrapped value to a Double precision float, returning the default in case the number can not be parsed.Parses the wrapped value to a Long integer, returning the default in case the number can not be parsed.Parses the wrapped value to a Long integer, returning the default in case the number can not be parsed.toString()
org.opencms.jsp.util.A_CmsJspValueWrapper
useDefault
(Object defaultValue) Returns a value wrapper for the provided default in case this value is empty.org.opencms.jsp.util.A_CmsJspValueWrapper
Compares this value against a list of Strings and returns this value in case the list contains the toString representation of this value, or aCmsJspObjectValueWrapper.NULL_VALUE_WRAPPER
otherwise.org.opencms.jsp.util.A_CmsJspValueWrapper
Checks this value against a list of Strings and returns this value in case the list contains the toString representation of this value, or aCmsJspObjectValueWrapper
based on the given default object otherwise.Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
NULL_VALUE_WRAPPER
Constant for the null (non existing) value. -
TEMP_XML2JSON_TREE
Attribute for used to cache the tree format of the XML content which is used to generate JSON.- See Also:
-
m_cms
The wrapped OpenCms user context. -
m_linkObj
Cached link wrapper - use Optional to distinguish 'uncached' state from 'does not exist'.
-
-
Method Details
-
createWrapper
public static CmsJspContentAccessValueWrapper createWrapper(CmsObject cms, I_CmsXmlContentValue value, I_CmsXmlContentValue parentValue, String valueName) Factory method to create a new XML content value wrapper.In case either parameter is
null
, theNULL_VALUE_WRAPPER
is returned.- Parameters:
cms
- the current users OpenCms contextvalue
- the value to warpparentValue
- the parent value, required to set the null value infovalueName
- the value path name- Returns:
- a new content value wrapper instance, or
null
if any parameter isnull
-
createWrapper
public static CmsJspContentAccessValueWrapper createWrapper(CmsObject cms, I_CmsXmlContentValue value, I_CmsXmlDocument content, String valueName, Locale locale) Factory method to create a new XML content value wrapper.In case either parameter is
null
, theNULL_VALUE_WRAPPER
is returned.- Parameters:
cms
- the current users OpenCms contextvalue
- the value to warpcontent
- the content document, required to set the null value infovalueName
- the value path namelocale
- the selected locale- Returns:
- a new content value wrapper instance, or
null
if any parameter isnull
-
getContentValue
Returns the wrapped content value.Note that this will return
null
whengetExists()
returnsfalse
.
- Returns:
- the wrapped content value
-
getExists
Returnstrue
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>
- Returns:
true
in case this value actually exists in the XML content it was requested from
-
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.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>
- Returns:
- a lazy initialized Map that provides Booleans that indicate if a sub value (xpath) for the current value is available in the XML content
-
getImageDndAttr
Returns the annotation that enables image drag and drop for this content value.Use to insert the annotation attributes into a HTML tag.
Only makes sense in case this node actually contains the path to an image.
Example using EL: <span ${value.Image.imageDndAttr}> ... </span> will result in <span data-imagednd="..."> ... </span>
- Returns:
- the annotation that enables image drag and drop for this content value
-
getIndex
Returns the node index of the XML content value in the source XML document, starting with 0.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>
- Returns:
- the locale of the current XML content value
-
getIsEmpty
Returnstrue
in case the value is empty, that is eithernull
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>
- Returns:
true
in case the value is empty
-
getIsEmptyOrWhitespaceOnly
Returnstrue
in case the value is empty or whitespace only, that is eithernull
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>
- Returns:
true
in case the value is empty or whitespace only
-
getJson
Gets the default JSON representation of a value.- Returns:
- the default JSON representation of the value
- Throws:
CmsException
-
getLocale
Returns the Locale of the current XML content value.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>
- Returns:
- the locale of the current XML content value
-
getName
Returns the xml node name of the wrapped content value.- Returns:
- the xml node name
- See Also:
-
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.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>
- Returns:
- a list with all available elements paths (Strings) available directly below this element
-
getObjectValue
Returns the raw instance of the wrapped value.- Returns:
- the raw instance of the wrapped value
- See Also:
-
A_CmsJspValueWrapper.getObjectValue()
-
getPath
Returns the path to the current XML content value.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>
- Returns:
- the path to the current XML content value
-
getRdfa
Returns a lazy initialized Map that provides the RDFA for nested sub values.The provided Map key is assumed to be a String that represents the relative xpath to the value.
- Returns:
- a lazy initialized Map that provides the RDFA for nested sub values
-
getRdfaAttr
Returns the RDF annotation to this content value.Use to insert the annotation attributes into a HTML tag.
Example using EL: <h1 ${value.Title.rdfaAttr}>${value.Title}</h1> will result in <h1 data-oc-id="..." data-oc-field="...">My title</h1>
- Returns:
- the RDFA
-
getResolve
Short form ofgetResolveMacros()
.- Returns:
- a value wrapper with macro resolving turned on
- See Also:
-
getResolveMacros
Turn on macro resolving for the wrapped value.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>
- Returns:
- a value wrapper with macro resolving turned on
- See Also:
-
getSubValueList
Returns a lazy initialized Map that provides the Lists of sub values directly below the current value from the XML content.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>
- Returns:
- a lazy initialized Map that provides a Lists of direct sub values of the current value from the XML content
-
getToDateSeries
Converts a date series configuration to a date series bean.- Returns:
- the date series bean.
-
getToParameters
Transforms the current value into a parameter map.The current value must be a nested content with sub-values that have exactly 2 values each, for example like this:
<Parameters> <Key><foo></Key> <Value><bar></Value> </Parameters> <Parameters> <Key><foo2></Key> <Value><bar2></Value> </Parameters>
Please note that the result Map is a simple String map, NOT a map withCmsJspContentAccessValueWrapper
classes.- Returns:
- the current value transformed into a parameter map
-
getTypeName
Returns the schema type name of the wrapped content value.- Returns:
- the type name
- See Also:
-
getValue
Returns a lazy initialized Map that provides the nested sub values for the current value from the XML content.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.- Returns:
- a lazy initialized Map that provides a sub value for the current value from the XML content
-
getValueList
Returns a lazy initialized Map that provides the Lists of nested sub values for the current value from the XML content.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>
- Returns:
- a lazy initialized Map that provides a Lists of sub values for the current value from the XML content
-
getXmlText
Returns a lazy initialized Map that provides direct access to the XML element for the current value from the XML content.- Returns:
- a lazy initialized Map that provides direct access to the XML element for the current value from the XML content
-
hashCode
The hash code is created from the file structure id of the underlying XML content, the selected locale and the path to the node in the XML content.- Specified by:
hashCode
in interfaceCollection<String>
- See Also:
-
obtainCmsObject
Deprecated.usegetCmsObject()
insteadReturns the wrapped OpenCms user context.Note that this will return
null
whengetExists()
returnsfalse
.- Returns:
- the wrapped OpenCms user context
-
obtainContentValue
Deprecated.usegetContentValue()
insteadReturns the wrapped content value.Note that this will return
null
whengetExists()
returnsfalse
. Method name does not start with "get" to prevent using it in the expression language.
- Returns:
- the wrapped content value
-
toString
- Overrides:
toString
in classAbstractCollection<String>
- See Also:
-
createPath
Returns the path to the XML content based on the current element path.This is used to create xpath information for sub-elements in the transformers.
- Parameters:
input
- the additional path that is appended to the current path- Returns:
- the path to the XML content based on the current element path
-
substituteLink
Returns the substituted link to the given target.- Parameters:
cms
- the cms contexttarget
- the link target- Returns:
- the substituted link
-
equals
- Specified by:
equals
in interfaceCollection<String>
- Overrides:
equals
in classObject
- See Also:
-
getCmsObject
Returns the current cms context.- Returns:
- the cms context
-
getContains
Returns a lazy initialized Map that provides Booleans which indicate if if the wrapped values String representation contains a specific String.The Object parameter is transformed to it's String representation to perform this check.
- Returns:
- a lazy initialized Map that provides Booleans which indicate if if the wrapped values String representation contains a specific String
-
getIsEqual
Returns a lazy initialized Map that provides Booleans which indicate if an Object is equal to the wrapped object.- Returns:
- a lazy initialized Map that provides Booleans which indicate if an Object is equal to the wrapped object
-
getIsSet
public boolean getIsSet()Returnstrue
in case the wrapped value exists and is not empty or whitespace only.- Returns:
true
in case the wrapped value exists and is not empty or whitespace only
-
getIsSetNotNone
public boolean getIsSetNotNone()Returnstrue
in case the wrapped value exists, is not empty or whitespace only and is also not equal to the String'none'
.- Returns:
true
in case the wrapped value exists, is not empty or whitespace only and is also not equal to the String'none'
-
getMathCeil
Calculates the next largest integer from the wrapped value.Note that the result is an Object of type
Long
, so in case the wrapped value can not be converted to a number,null
is returned. This means you can check for anempty
result in the EL.- Returns:
- the next largest integer for the wrapped value
-
getMathFloor
Calculates the next smallest integer from the wrapped value.Note that the result is an Object of type
Long
, so in case the wrapped value can not be converted to a number,null
is returned. This means you can check for anempty
result in the EL.- Returns:
- the next smallest integer for the wrapped value
-
getMathRound
Calculates the next integer from the wrapped value by rounding.Note that the result is an Object of type
Long
, so in case the wrapped value can not be converted to a number,null
is returned. This means you can check for anempty
result in the EL.- Returns:
- the next integer for the wrapped value calculated by rounding
-
getStringValue
Deprecated.usegetToString()
insteadReturns the String value for the wrapped content value.This will return the empty String
""
whengetExists()
returnsfalse
.
- Returns:
- the String value of the wrapped content value
-
getStripHtml
Assumes the wrapped value is a String and strips all HTML markup from this String.- Returns:
- the wrapped value with all HTML stripped.
-
getToBoolean
public boolean getToBoolean()Converts the wrapped value to a boolean.- Returns:
- the boolean value
-
getToContainerPage
Tries to create a container page wrapper from the wrapped value.- Returns:
- the container page wrapper or null if none could be created
-
getToDate
Converts the wrapped value to a date.- Returns:
- the date
- See Also:
-
getToDouble
Parses the wrapped value to a Double precision float.Note that the result is an Object of type
Double
, so in case the wrapped value can not be converted to a number,null
is returned. This means you can check for anempty
result in the EL.- Returns:
- the Double precision float value
-
getToFloat
Parses the wrapped value to a Double precision float.Note that the result is an Object of type
Double
, so in case the wrapped value can not be converted to a number,null
is returned. This means you can check for anempty
result in the EL.- Returns:
- the Double precision float value
-
getToImage
Returns a scaled image bean from the wrapped value.In case the value does not point to an image resource,
null
is returned.- Returns:
- the scaled image bean
-
getToInstanceDate
Converts a date to an instance date bean.- Returns:
- the instance date bean.
-
getToInteger
Parses the wrapped value to a Long integer.Note that the result is an Object of type
Long
, so in case the wrapped value can not be converted to a number,null
is returned. This means you can check for anempty
result in the EL.- Returns:
- the Long integer value
- See Also:
-
getToLink
Converts the value to a link wrapper.- Returns:
- the link wrapper
-
getToLinkStr
Returns the substituted link to the wrapped value.In case no link can be substituted from the wrapped value, an empty String
""
is returned.- Returns:
- the substituted link
-
getToLocale
Converts the wrapped value to a java.util.Locale instance using the locale manager.- Returns:
- the locale instance for the wrapped value
-
getToLong
Parses the wrapped value to a Long integer.Note that the result is an Object of type
Long
, so in case the wrapped value can not be converted to a number,null
is returned. This means you can check for anempty
result in the EL.- Returns:
- the Long integer value
- See Also:
-
getToResource
Returns the resource this value if pointing to.It is assumed the value holds a valid resource UIR in the OpenCms VFS. In case the value cannot be converted to a resource, an error is logged but no exception is thrown.
- Returns:
- the resource this value if pointing to
-
getToString
Returns the wrapped value as a String.This will always be at least an empty String
""
, nevernull
.- Returns:
- the wrapped value as a String
-
getTrimToSize
Returns a lazy initialized map that provides trimmed to size strings of the wrapped object string value. The size being the integer value of the key object.- Returns:
- a map that provides trimmed to size strings of the wrapped object string value
-
isEmpty
public boolean isEmpty()Supports the use of theempty
operator in the JSP EL by implementing the Collection interface.- Specified by:
isEmpty
in interfaceCollection<String>
- Overrides:
isEmpty
in classAbstractCollection<String>
- Returns:
- the value from
getIsEmptyOrWhitespaceOnly()
which is the inverse ofgetIsSet()
. - See Also:
-
isValid
Compares this value against a list of Strings and returnstrue
in case the list contains the toString representation of this value, or afalse
otherwise.- Parameters:
allowedValues
- the list of allowed String values- Returns:
- returns
true
in case the list contains the toString representation of this value, or afalse
otherwise - See Also:
-
iterator
Supports the use of theempty
operator in the JSP EL by implementing the Collection interface.- Specified by:
iterator
in interfaceCollection<String>
- Specified by:
iterator
in interfaceIterable<String>
- Specified by:
iterator
in classAbstractCollection<String>
- Returns:
- an empty Iterator in case
AbstractCollection.isEmpty()
istrue
, otherwise an Iterator that will return the String value of this wrapper exactly once. - See Also:
-
size
public int size()Supports the use of theempty
operator in the JSP EL by implementing the Collection interface.- Specified by:
size
in interfaceCollection<String>
- Specified by:
size
in classAbstractCollection<String>
- Returns:
- always returns 0.
- See Also:
-
toDouble
Parses the wrapped value to a Double precision float, returning the default in case the number can not be parsed.- Parameters:
def
- the default in case the wrapped value can not be converted to a number- Returns:
- a Double precision float value
- See Also:
-
toFloat
Parses the wrapped value to a Double precision float, returning the default in case the number can not be parsed.- Parameters:
def
- the default in case the wrapped value can not be converted to a number- Returns:
- a Double precision float value
- See Also:
-
toInteger
Parses the wrapped value to a Long integer, returning the default in case the number can not be parsed.- Parameters:
def
- the default in case the wrapped value can not be converted to a number- Returns:
- a Long integer value
- See Also:
-
toLong
Parses the wrapped value to a Long integer, returning the default in case the number can not be parsed.- Parameters:
def
- the default in case the wrapped value can not be converted to a number- Returns:
- a Long integer value
- See Also:
-
useDefault
Returns a value wrapper for the provided default in case this value is empty.If this value is empty, the object returned will be of type
CmsJspObjectValueWrapper
. This means you can only use simple "get me the value as type X" operations on the result safely.- Parameters:
defaultValue
- the object to generate the default value from- Returns:
- a value wrapper for the provided default in case this value is empty.
- See Also:
-
validate
Compares this value against a list of Strings and returns this value in case the list contains the toString representation of this value, or aCmsJspObjectValueWrapper.NULL_VALUE_WRAPPER
otherwise.- Parameters:
allowedValues
- the list of allowed String values- Returns:
- returns this value in case the list contains the toString representation of this value,
or a
CmsJspObjectValueWrapper.NULL_VALUE_WRAPPER
otherwise - See Also:
-
validate
public org.opencms.jsp.util.A_CmsJspValueWrapper validate(List<String> allowedValues, Object defaultValue) Checks this value against a list of Strings and returns this value in case the list contains the toString representation of this value, or aCmsJspObjectValueWrapper
based on the given default object otherwise.- Parameters:
allowedValues
- the list of allowed String valuesdefaultValue
- the object to generate the default value from- Returns:
- returns this value in case the list contains the toString representation of this value,
or a
CmsJspObjectValueWrapper
based on the given default object otherwise - See Also:
-
getToString()
instead