![MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual Download Page 405](http://html1.mh-extra.com/html/macromedia/coldfusion-5-developing/coldfusion-5-developing_develop-manual_3293641405.webp)
Calling Java Objects
385
To disable automatic class loading, put all classes in the normal Java class path.
Classes located on the Java class path are loaded once per server lifetime and can
only be reloaded by stopping and restarting ColdFusion Server.
A more complex Java example
The following code provides a more complete example of using Java with
cfobject.
The Example class manipulates integer, float, array, Boolean, and Example object
types.
The Example class
The following Java code defines the Example class. The Java class Example has one
public integer member,
mPublicInt
. Its constructor initializes
mPublicInt
to 0 or an
integer argument. The class has the following public methods:
public class Example {
public int mPublicInt;
public Example() {
mPublicInt = 0;
}
public Example(int IntVal) {
mPublicInt = IntVal;
}
public String ReverseString(String s) {
StringBuffer buffer = new StringBuffer(s);
return new String(buffer.reverse());
}
public String[] ReverseStringArray(String [] arr) {
Method
Description
ReverseString
Reverses the order of a string.
ReverseStringArray
Reverses the order of elements in an array of strings.
Add
Overloaded: Adds and returns two integers or floats or
adds the
mPublicInt
members of two Example class
objects and returns an Example class object.
SumArray
Returns the sum of the elements in an integer array.
SumObjArray
Adds the values of the
mPublicInt
members of an array of
Example class objects and returns an Example class
object.
ReverseArray
Reverses the order of an array of integers.
Flip
Switches a boolean value.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...