Executes the specified operation (methode) for the informed object.

1 java.invoke

<java.invoke name='name'>
    <args /> ?
    <body /> !
</java.invoke>

Exceptions

attribute 'name' required

The name of the methode to use has been specified.

expected 'args' while found [...]

The arguments of the function has been specified.

expected 'body' while found [...]

The object on which the operation is executed has not been informed.

Example

Invoke the add methode of the Vector class.

Copy
<xsql-script name='java_instance_sample1'>
    <body>
        <set name='vector'>
            <java.newInstance name='java.util.Vector' />
        </set>
        <java.invoke name='add'>
            <args>
                <arg type='int'>0</arg>
                <arg type='object'>zero</arg>
            </args>
            <body>
                <vector/>
            </body>
        </java.invoke>
    </body>
</xsql-script>

The possible values which admites the attribute type of the label <arg> are:

boolean

char

byte

short

int

long

float

double

decimal (java.math.BigDecimal)

string (java.lang.String)

date (java.util.Date)

time (java.sql.Time)

timestamp (java.sql.Timestamp)

array (java.util.ArrayList)

map (java.util.HashMap)

objec (java.lang.Object)

Example

Invoke the methode intValue about a Number to obtain the whole value of the number. In the example the number is a decimal 2.4 and the function intValue will return the integer 2.

Copy
<xsql-script name='java_invoke_number_intValue'>
    <body>
        <println>
            <java.invoke name='intValue'>
                <args />
                <body>
                    <number>2.4</number>
                </body>
            </java.invoke>
        </println>
    </body>
</xsql-script>