|
||||||||
| PREV NEXT | FRAMES NO FRAMES | |||||||
See:
Description
| Packages | |
|---|---|
| com.emarson.lemonade.bluelemon.midp1 | Classes reflecting the functionality of the selected MIDP1 classes. |
| managers | Managers are the key components of the Bluelemon Runtime Environment. |
| types | Reflects the Bluelemon types. |
The API of the Bluelemon components used in the Lemonade package.
Here are some key concepts related to Bluelemon:
The following Bluelemon-specific types are available:
All the objects of these types are seen as a byte array for the Bluelemon Runtime Environment (BRE).
If not specified otherwise in this API, for most of the methods any numeric type can be used - byte, short, int or long. Depending on the type declared, Bluelemon Buildtime Environment will need to use respectively 1, 2, 4 and 8 bytes - to make a compiled code short, it is recommended to choose the lowest type required when declaring the type.
It is possible to make call operations on three types of entities: managers, objects and nodes.
The nodes are desribed in the sections that follow.
The managers are described in the managers package.
The object represent the instance of the Java class prepared to work
with Bluelemon. All standard classes available in the Lemonade package
are described in the description of the package
com.emarson.lemonade.bluelemon.midp1
No matter what type of the entity is being called, the expression being used is similar:
<blue:call [entity specific information]
toVariable="variableName"
castTo="classToCastTo">
<blue:argument type="bluelemonType" value="typedValue"/>
<blue:argument type="bluelemonType" contextKey="keyInTheContext"/>
<blue:argument type="variable" name="variableName"/>
</blue:call>
Nodes are used for identifying a resource and providing a means of locating the resource.
The node consists of two elements - name and location. The name should be unique in a given location.
There are four types of locations:
To speed up the processing, names of the nodes are encoded during the build time. Encoding mechanism generates the digests in the iterative fashion, so it is important to keep the generated digests for the time of delivering any services using the Lemonade.
It is possible to get the content of the node, set it (except the nodes of type @[package]) and call it. Below are some examples:
<blue:get node="com/emarson/example/Name"
location="permanent" toVariable="myName"/>
<blue:set node="com/emarson/example/Age" location="session">
<blue:argument type="byte" value="18"/>
</blue:call>
<blue:call node="com/emarson/example/SomeCode" location="network"/>
<blue:get node="com/emarson/example/package/Image"
location="@permanentcom/emarson/example/package"
toVariable="image"/>
<blue:get node="com/emarson/example/Picture" location="network">
<blue:argument type="variable" name="userId"/>
<blue:argument type="variable" name="password"/>
<blue:argument type="dataset">
<blue:descriptor>
<blue:field type="byte"/>
<blue:field type="String"/>
</blue:descriptor>
<blue:row>
<blue:field value="5"/>
<blue:field value="value"/>
</blue:row>
</blue:argument>
</blue:call>
The conditional expressions are available in Bluelemon. Here is the example:
<blue:if isTrue="itsSunday">
// do something on Sunday
<blue:if isTrue="itsEvening">
// do something on Sunday evening
</blue:if>
<blue:else>
// do something before or after Sunday evening
</blue:else>
</blue:if>
Loops are available in Bluelemon. It is an infinite
loop and programmer is responsible to make sure
the loop will break.
Here is the example:
<!-- set the 'counter' variable to 0 -->
<blue:call manager="UtilsManager" method="this"
toVariable="counter">
<blue:argument type="byte" value="0"/>
</blue:call>
<!-- loop 4 times -->
<blue:loop>
<blue:call manager="UtilsManager" method="lesserThan"
toVariable="breakFromLoop">
<blue:argument type="variable" name="counter"/>
<blue:argument type="byte" value="4"/>
</blue:call>
<blue:if isTrue="breakFromLoop">
<blue:break/>
</blue:if>
// do something in the loop
<blue:call manager="UtilsManager" method="++">
<blue:argument type="variable" name="counter"/>
</blue:call>
</blue:loop>
|
||||||||
| PREV NEXT | FRAMES NO FRAMES | |||||||