A mechanism to extend MINERVA on-the-fly with functionality given in Java classes....
Move to
=> <=
Darueber Spitze
See also
High Level
Reflection
static
IF Computer > MINERVA > Manual > Reference > MINERVA to Java Interface > Reflection

Reflection

A mechanism to extend MINERVA on-the-fly with functionality given in Java classes.

The use of reflection is an alternative to the static addition of Java extensions to MINERVA via minervax.

Semantics:

Generating a MINERVA predicate from a Java method object, the follwing holds:

  • If the method returns type 'void', then the predicate succeeds. There is no return term.

  • If the method returns type 'boolean', then the predicate succeeds or fails a accordingly. There is no return term.

  • Otherwise the predicate succeeds. The result of the method is returned as the last argument of the predicate.

  • If the method is not 'static', i.e. a class method, then the predicate additionally takes as first argument the object to which the method is applied.
Summary:

	static void fun(X, Y)		=>	fun(X, Y)
	void fun(X, Y)			=>	fun(Object, X, Y)
	static boolean fun(X, Y)	=>	fun(X, Y)
	boolean fun(X, Y)		=>	fun(Object, X, Y)
	static int fun(X, Y)		=>	fun(X, Y, Result)
	int fun(X, Y)			=>	fun(Object, X, Y, Result)
The predicate invoke_method/4 can be used to directly invoke a method, i.e. without using declare_method/2.
	invoke_method(+Method, +Object, +ArgumentList, -Result)
Example:
	:
	get_class('java.lang.String', String),
	get_class(int, Integer),
	get_method(String, substring, [Integer,Integer], Substring),
	invoke_method(Substring, hello, [1,4], Result).

==> Result = ell

For more usage examples refer to the ExamplePrograms section.

  • Examples:
    • ExamplePrograms/MinervaFeatures/Reflection

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Sprache
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/MinervaToJavaInterface/Reflection/home_de.html
published 2008/10/6 update 2002/3/20 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS