Portlet Factory, Version 6.1.2


 

Linked Java Object builder

The Linked Java Object builder adds the public methods of a Java class to the web application.

You can use the Linked Java Object builder to incorporate existing Java code or you can create new Java classes to be used with Linked Java Object builder calls to consolidate commonly used methods into a single, easily re-used Java class.

 

Quick tips

Provide your methods with access to the current webAppAccess object

You can provide the methods in your LJOs with access to the current webAppAccess object by declaring that those methods take at least one argument of type WebAppAccess. For example,
public IXml getCustomers(WebAppAccess myWebApp) {...}

Note: Do not store the WebAppAccess object as a member variable because it can become stale as LJOs remain instantiated throughout the execution of the Web application.

Simplifying linked Java object method calls

Set the Model Method Base input to Use this Linked Java Object's class as a base for all methods in model.

Using this naming convention allows you to call methods in the Linked Java Object with webAppAccess.callMethod("MethodName"); instead of webAppAccess.callMethod("LJOName.MethodName");.

Persisting linked Java objects during failover

LJOs persist during a failover event if the underlying Java class implements the Serializable interface.

Avoid overloading methods in linked Java objects

If you are creating Java source files to be used as linked Java objects, create unique methods instead of overloading one method. Doing so ensures predictable behavior and makes choosing those methods easier when you use the data picker or various select boxes for assigning actions to controls.

To use overloaded methods in your linked Java object, try to write them all before you add the linked Java object to your model. Then builder calls can invoke the correct method. If you do need to overload methods after adding the linked Java object to your model, examine each builder call that calls a variation of the overloaded method and confirm that it is calling the appropriate method.

Parent topic: Builder help


Library | Support |