Developer

List Variables

List variables do not appear in the state editor. You can use list variables to save lists of the BeanConverterInterface type to session variables.

As an example, the AbstractDynamicMenu class uses a list variable to persist an SMS menu. The BeanConverterInterface specifies that a bean must provide string serialization and deserialization logic. Each BeanConverterInterface item is saved as a session variable with a unique name.

package com.sybase365.mobiliser.brand.plugins.smapp.beans;   
public interface BeanConverterInterface<T> {     
  T convert(String value);     
  String convert(T object);   
} 

The SessionVariableAttribute class has two methods: getList and setList. The getList method retrieves a list from the database. When setList is called, the list is saved to a session variable, which requires a database connection.

Most state implementations do not need list variables. They are needed only if a state can transition into an internal waiting condition by calling waitForMessage. For example, list variables are most commonly used when sending SMS messages. Calling waitForMessage causes the application to hibernate until the response arrives. The list variable is saved to a session variable, so it is available when the application is reactivated.