Tune javadoc for distribution build.

This commit is contained in:
James Roseborough
2011-01-26 06:02:06 +00:00
parent e820f00b12
commit c49ede53e4
4 changed files with 87 additions and 17 deletions

View File

@@ -1325,17 +1325,18 @@ public class LuaValue extends Varargs {
* <p>
* To iterate over integer keys in a table you can use
* <pre> {@code
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.inext(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }</pre>
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.inext(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }
* } </pre>
* @param index {@link LuaInteger} value identifying a key to start from,
* or {@link NIL} to start at the beginning
* @return {@link Varargs} containing {key,value} for the next entry,
* @return {@link Varargs} containing {@code (key,value)} for the next entry,
* or {@link NONE} if there are no more.
* @throws LuaError if {@code this} is not a table, or the supplied key is invalid.
* @see LuaTable

View File

@@ -31,12 +31,38 @@ import org.luaj.vm2.LuaValue;
/**
* Helper class to coerce values from Java to lua within the luajava library.
* <p>
* This class is primarily used by the {@link LuajavaLib},
* but can also be used directly when working with Java/lua bindings.
* <p>
* To coerce scalar types, the various, generally the {@code valueOf(type)} methods
* on {@link LuaValue} may be used:
* <ul>
* <li>{@link LuaValue#valueOf(boolean)}</li>
* <li>{@link LuaValue#valueOf(byte[])}</li>
* <li>{@link LuaValue#valueOf(double)}</li>
* <li>{@link LuaValue#valueOf(int)}</li>
* <li>{@link LuaValue#valueOf(String)}</li>
* </ul>
* <p>
* To coerce arrays of objects and lists, the {@code listOf(..)} and {@code tableOf(...)} methods
* on {@link LuaValue} may be used:
* <ul>
* <li>{@link LuaValue#listOf(LuaValue[])}</li>
* <li>{@link LuaValue#listOf(LuaValue[], org.luaj.vm2.Varargs)}</li>
* <li>{@link LuaValue#tableOf(LuaValue[])}</li>
* <li>{@link LuaValue#tableOf(LuaValue[], LuaValue[], org.luaj.vm2.Varargs)}</li>
* </ul>
* The method {@link CoerceJavaToLua#coerce(Object)} looks as the type and dimesioning
* of the argument and tries to guess the best fit for corrsponding lua scalar,
* table, or table of tables.
*
* @see CoerceJavaToLua#coerce(Object)
* @see LuajavaLib
*/
public class CoerceJavaToLua {
public static interface Coercion {
static interface Coercion {
public LuaValue coerce( Object javaValue );
};
@@ -82,6 +108,22 @@ public class CoerceJavaToLua {
COERCIONS.put( String.class, stringCoercion );
}
/**
* Coerse a Java object to a corresponding lua value.
* <p>
* Integral types {@code boolean}, {@code byte}, {@code char}, and {@code int}
* will become {@link LuaInteger};
* {@code long}, {@code float}, and {@code double} will become {@link LuaDouble};
* {@code String} and {@code byte[]} will become {@link LuaString};
* other types will become {@link LuaUserdata}.
* @param o Java object needing conversion
* @return {@link LuaValue} corresponding to the supplied Java value.
* @see LuaValue
* @see LuaInteger
* @see LuaDouble
* @see LuaString
* @see LuaUserdata
*/
public static LuaValue coerce(Object o) {
if ( o == null )
return LuaValue.NIL;

View File

@@ -31,12 +31,34 @@ import org.luaj.vm2.Varargs;
/**
* Helper class to coerce values from lua to Java within the luajava library.
* <p>
* This class is primarily used by the {@link LuajavaLib},
* but can also be used directly when working with Java/lua bindings.
* <p>
* To coerce to specific Java values, generally the {@code toType()} methods
* on {@link LuaValue} may be used:
* <ul>
* <li>{@link LuaValue#toboolean()}</li>
* <li>{@link LuaValue#tobyte()}</li>
* <li>{@link LuaValue#tochar()}</li>
* <li>{@link LuaValue#toshort()}</li>
* <li>{@link LuaValue#toint()}</li>
* <li>{@link LuaValue#tofloat()}</li>
* <li>{@link LuaValue#todouble()}</li>
* <li>{@link LuaValue#tojstring()}</li>
* <li>{@link LuaValue#touserdata()}</li>
* <li>{@link LuaValue#touserdata(Class)}</li>
* </ul>
* <p>
* For data in lua tables, the various methods on {@link LuaTable} can be used directly
* to convert data to something more useful.
*
* @see LuajavaLib
* @see CoerceJavaToLua
*/
public class CoerceLuaToJava {
public static interface Coercion {
static interface Coercion {
public Object coerce( LuaValue value );
public int score( int paramType );
};