Improve javadoc for luajava classes.

This commit is contained in:
James Roseborough
2011-03-03 18:47:28 +00:00
parent 90839804ef
commit abba1501f9
6 changed files with 60 additions and 11 deletions

View File

@@ -29,9 +29,15 @@ import org.luaj.vm2.LuaValue;
/** /**
* LuaValue that represents a Java instance of array type. * LuaValue that represents a Java instance of array type.
* <p> * <p>
* Can get elements by their integer key index, as well as the length. * Can get elements by their integer key index, as well as the length.
* <p>
* This class is not used directly.
* It is returned by calls to {@link CoerceJavaToLua#coerce(Object)}
* when an array is supplied.
* @see CoerceJavaToLua
* @see CoerceLuaToJava
*/ */
public class JavaArray extends LuaUserdata { class JavaArray extends LuaUserdata {
static final LuaValue LENGTH = valueOf("length"); static final LuaValue LENGTH = valueOf("length");

View File

@@ -33,15 +33,21 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.luaj.vm2.LuaError;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;
/** /**
* LuaValue that represents a Java class. * LuaValue that represents a Java class.
* <p> * <p>
* Will respond to get() and set() by returning field values, or java methods. * Will respond to get() and set() by returning field values, or java methods.
* <p>
* This class is not used directly.
* It is returned by calls to {@link CoerceJavaToLua#coerce(Object)}
* when a Class is supplied.
* @see CoerceJavaToLua
* @see CoerceLuaToJava
*/ */
public class JavaClass extends JavaInstance implements CoerceJavaToLua.Coercion { class JavaClass extends JavaInstance implements CoerceJavaToLua.Coercion {
static final Map classes = Collections.synchronizedMap(new HashMap()); static final Map classes = Collections.synchronizedMap(new HashMap());

View File

@@ -37,8 +37,14 @@ import org.luaj.vm2.lib.VarArgFunction;
* <p> * <p>
* May be called with arguments to return a JavaInstance * May be called with arguments to return a JavaInstance
* created by calling the constructor. * created by calling the constructor.
* <p>
* This class is not used directly.
* It is returned by calls to {@link JavaClass#new(LuaValue key)}
* when the value of key is "new".
* @see CoerceJavaToLua
* @see CoerceLuaToJava
*/ */
public class JavaConstructor extends JavaMember { class JavaConstructor extends JavaMember {
static final Map constructors = Collections.synchronizedMap(new HashMap()); static final Map constructors = Collections.synchronizedMap(new HashMap());
@@ -71,6 +77,15 @@ public class JavaConstructor extends JavaMember {
} }
} }
/**
* LuaValue that represents an overloaded Java constructor.
* <p>
* On invocation, will pick the best method from the list, and invoke it.
* <p>
* This class is not used directly.
* It is returned by calls to calls to {@link JavaClass#get(LuaValue key)}
* when key is "new" and there is more than one public constructor.
*/
static class Overload extends VarArgFunction { static class Overload extends VarArgFunction {
final JavaConstructor[] constructors; final JavaConstructor[] constructors;
public Overload(JavaConstructor[] c) { public Overload(JavaConstructor[] c) {

View File

@@ -31,8 +31,14 @@ import org.luaj.vm2.LuaValue;
* LuaValue that represents a Java instance. * LuaValue that represents a Java instance.
* <p> * <p>
* Will respond to get() and set() by returning field values or methods. * Will respond to get() and set() by returning field values or methods.
* <p>
* This class is not used directly.
* It is returned by calls to {@link CoerceJavaToLua#coerce(Object)}
* when a subclass of Object is supplied.
* @see CoerceJavaToLua
* @see CoerceLuaToJava
*/ */
public class JavaInstance extends LuaUserdata { class JavaInstance extends LuaUserdata {
JavaClass jclass; JavaClass jclass;

View File

@@ -29,7 +29,14 @@ import org.luaj.vm2.lib.jse.CoerceLuaToJava.Coercion;
* Java method or constructor. * Java method or constructor.
* <p> * <p>
* Primarily handles argument coercion for parameter lists including scoring of compatibility and * Primarily handles argument coercion for parameter lists including scoring of compatibility and
* java varargs handling. * java varargs handling.
* <p>
* This class is not used directly.
* It is an abstract base class for {@link JavaConstructor} and {@link JavaMethod}.
* @see JavaConstructor
* @see JavaMethod
* @see CoerceJavaToLua
* @see CoerceLuaToJava
*/ */
abstract abstract
class JavaMember extends VarArgFunction { class JavaMember extends VarArgFunction {

View File

@@ -31,14 +31,19 @@ import org.luaj.vm2.LuaError;
import org.luaj.vm2.LuaFunction; import org.luaj.vm2.LuaFunction;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs; import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.jse.CoerceLuaToJava.Coercion;
/** /**
* LuaValue that represents a Java method. * LuaValue that represents a Java method.
* <p> * <p>
* Can be invoked. * Can be invoked via call(LuaValue...) and related methods.
* <p>
* This class is not used directly.
* It is returned by calls to calls to {@link JavaInstance#get(LuaValue key)}
* when a method is named.
* @see CoerceJavaToLua
* @see CoerceLuaToJava
*/ */
public class JavaMethod extends JavaMember { class JavaMethod extends JavaMember {
static final Map methods = Collections.synchronizedMap(new HashMap()); static final Map methods = Collections.synchronizedMap(new HashMap());
@@ -94,7 +99,11 @@ public class JavaMethod extends JavaMember {
/** /**
* LuaValue that represents an overloaded Java method. * LuaValue that represents an overloaded Java method.
* <p> * <p>
* On invocation, will pick the best method fromi the list, and invoke it. * On invocation, will pick the best method from the list, and invoke it.
* <p>
* This class is not used directly.
* It is returned by calls to calls to {@link JavaInstance#get(LuaValue key)}
* when an overloaded method is named.
*/ */
static class Overload extends LuaFunction { static class Overload extends LuaFunction {