Start page / Template development / Template syntax / Data types / Boolean

Boolean data typeAvailable from FirstSpirit Version 4.0

Value range of the Boolean data type

A Boolean data type can assume one of two possible values:

  • true
  • false

Boolean values are used in FirstSpirit as return values of Input components and in expressions.

For further information on the Boolean data type, see the Sun API documentation: java.lang.Boolean

Definition

The Boolean data type can be explicitly used in expressions, e.g. for allocations

$CMS_SET(isValid, true)$

or in checks :

$CMS_IF(varName == true)$
...
$CMS_END_IF$

Definition using the standard input components

Different input components can be defined in the form area of a page or section template. These form elements can then be used to insert the actual editorial contents into the page. The Standard input components supported by FirstSpirit return different data types.

The following standard input components return an object of data type Boolean :

Then, with the help of a $CMS_VALUE(...)$ instruction, methods can then be applied to this object:

$CMS_VALUE(IDENTIFIER.METHOD)$

Under IDENTIFIER , the resultnameparameter, defined in the input component, must be specified.

The object is generated by the following form objects:
CMS_INPUT_TOGGLE
Method name Return type Brief description Available since
booleanValue boolean
compare(boolean, boolean) int
compareTo(Object) int
describeConstable Optional
equals(Object) boolean
getBoolean(String) boolean
getClass Class Class of the invoking object
hashCode(boolean) int
isCase(Object) boolean
isNull boolean Checks whether an expression is null (zero)
logicalAnd(boolean, boolean) boolean
logicalOr(boolean, boolean) boolean
logicalXor(boolean, boolean) boolean
parseBoolean(String) boolean
print void
set(String, Object) Object
toJSON String Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value. 5.2.11
toString String
toString(boolean) String
type String
valueOf(String) Boolean
valueOf(boolean) Boolean

booleanValue

Method name Return type Available since
booleanValue boolean

compare(boolean, boolean)

Method name Return type Available since
compare(boolean, boolean) int

compareTo(Object)

Method name Return type Available since
compareTo(Object) int

describeConstable

Method name Return type Available since
describeConstable Optional

equals(Object)

Method name Return type Available since
equals(Object) boolean

getBoolean(String)

Method name Return type Available since
getBoolean(String) boolean

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

hashCode(boolean)

Method name Return type Available since
hashCode(boolean) int

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

logicalAnd(boolean, boolean)

Method name Return type Available since
logicalAnd(boolean, boolean) boolean

logicalOr(boolean, boolean)

Method name Return type Available since
logicalOr(boolean, boolean) boolean

logicalXor(boolean, boolean)

Method name Return type Available since
logicalXor(boolean, boolean) boolean

parseBoolean(String)

Method name Return type Available since
parseBoolean(String) boolean

print

Method name Return type Available since
print void

set(String, Object)

Method name Return type Available since
set(String, Object) Object

toJSON

Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value.
Method name Return type Available since
toJSON String 5.2.11

toString

Method name Return type Available since
toString String

toString(boolean)

Method name Return type Available since
toString(boolean) String

type

Method name Return type Available since
type String

valueOf(String)

Method name Return type Available since
valueOf(String) Boolean

valueOf(boolean)

Method name Return type Available since
valueOf(boolean) Boolean

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.13 | Data privacy