2. Fixed values

As we have seen in our example we’ve loaded the processor parameters with string values using the <string> tag. This tag is used to create a fixed string value.

Each value type that Projector is aware of has a corresponding element to instantiate it. The following table shows the core types that are defined in the Projector core application and a simple example how to create them.

Table 7.1. Core types

TypeExample
String
<string>Some text</string>
Boolean
<boolean>true</boolean>
Number
<number>4711</number>
Date
<date>537456834756</date>
Locale
<locale>en_US</locale>
Array
<array>
   <string>First element</string>
   <string>Second element</string>
</array>
Map
<map>
   <entry key=”name”>
      <string>Tony Tomato</string>
   </entry>
   <entry key=”trusted”>
      <boolean>true</boolean>
   </entry>
</map>
XML
<xml>
   <news>
      <title>Slide 3.0 released</title>
      <author>Apache Software Foundation</author>
   </news>
</xml>
URI
<uri>/projector/applications/myproject</uri>
Message
<message id=”login successful”>
   <string>Tony Tomato</string>
   <number>2</number>
</message>

As you can see from this table Projector also supports complex data types like arrays, lists and maps. These complex types can be nested so that a map can contain an array or a map as a map entry. We will need this ability in some of the upcoming examples and see how it works.