Revert to 1.4 style usage
This commit is contained in:
@@ -59,7 +59,7 @@ public class CoerceLuaToJava {
|
|||||||
};
|
};
|
||||||
Coercion intCoercion = new Coercion() {
|
Coercion intCoercion = new Coercion() {
|
||||||
public Object coerce(LValue value) {
|
public Object coerce(LValue value) {
|
||||||
return Integer.valueOf( value.toJavaInt() );
|
return new Integer( value.toJavaInt() );
|
||||||
}
|
}
|
||||||
public int score(LValue value) {
|
public int score(LValue value) {
|
||||||
if ( value instanceof LInteger )
|
if ( value instanceof LInteger )
|
||||||
@@ -73,7 +73,7 @@ public class CoerceLuaToJava {
|
|||||||
};
|
};
|
||||||
Coercion doubleCoercion = new Coercion() {
|
Coercion doubleCoercion = new Coercion() {
|
||||||
public Object coerce(LValue value) {
|
public Object coerce(LValue value) {
|
||||||
return Double.valueOf( value.toJavaDouble() );
|
return new Double( value.toJavaDouble() );
|
||||||
}
|
}
|
||||||
public int score(LValue value) {
|
public int score(LValue value) {
|
||||||
if ( value instanceof LDouble )
|
if ( value instanceof LDouble )
|
||||||
@@ -102,9 +102,9 @@ public class CoerceLuaToJava {
|
|||||||
if ( value instanceof LString )
|
if ( value instanceof LString )
|
||||||
return value.toJavaString();
|
return value.toJavaString();
|
||||||
if ( value instanceof LInteger )
|
if ( value instanceof LInteger )
|
||||||
return Integer.valueOf(value.toJavaInt());
|
return new Integer(value.toJavaInt());
|
||||||
if ( value instanceof LDouble )
|
if ( value instanceof LDouble )
|
||||||
return Double.valueOf(value.toJavaDouble());
|
return new Double(value.toJavaDouble());
|
||||||
if ( value instanceof LBoolean )
|
if ( value instanceof LBoolean )
|
||||||
return Boolean.valueOf(value.toJavaBoolean());
|
return Boolean.valueOf(value.toJavaBoolean());
|
||||||
if ( value == LNil.NIL )
|
if ( value == LNil.NIL )
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public final class LuajavaLib extends LFunction {
|
|||||||
Constructor[] cons = clazz.getConstructors();
|
Constructor[] cons = clazz.getConstructors();
|
||||||
for ( int i=0; i<cons.length; i++ ) {
|
for ( int i=0; i<cons.length; i++ ) {
|
||||||
Constructor con = cons[i];
|
Constructor con = cons[i];
|
||||||
Integer n = Integer.valueOf( con.getParameterTypes().length );
|
Integer n = new Integer( con.getParameterTypes().length );
|
||||||
List list = (List) index.get(n);
|
List list = (List) index.get(n);
|
||||||
if ( list == null )
|
if ( list == null )
|
||||||
index.put( n, list = new ArrayList() );
|
index.put( n, list = new ArrayList() );
|
||||||
@@ -243,7 +243,7 @@ public final class LuajavaLib extends LFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// figure out best list of arguments == supplied args
|
// figure out best list of arguments == supplied args
|
||||||
Integer n = Integer.valueOf( params.classes.length );
|
Integer n = new Integer( params.classes.length );
|
||||||
List list = (List) index.get(n);
|
List list = (List) index.get(n);
|
||||||
if ( list == null )
|
if ( list == null )
|
||||||
throw new IllegalArgumentException("no constructor with "+n+" args");
|
throw new IllegalArgumentException("no constructor with "+n+" args");
|
||||||
@@ -296,7 +296,7 @@ public final class LuajavaLib extends LFunction {
|
|||||||
for ( int i=0; i<meths.length; i++ ) {
|
for ( int i=0; i<meths.length; i++ ) {
|
||||||
Method meth = meths[i];
|
Method meth = meths[i];
|
||||||
String s = meth.getName();
|
String s = meth.getName();
|
||||||
Integer n = Integer.valueOf(meth.getParameterTypes().length);
|
Integer n = new Integer(meth.getParameterTypes().length);
|
||||||
Map map = (Map) index.get(s);
|
Map map = (Map) index.get(s);
|
||||||
if ( map == null )
|
if ( map == null )
|
||||||
index.put( s, map = new HashMap() );
|
index.put( s, map = new HashMap() );
|
||||||
@@ -311,7 +311,7 @@ public final class LuajavaLib extends LFunction {
|
|||||||
Map map = (Map) index.get(methodName);
|
Map map = (Map) index.get(methodName);
|
||||||
if ( map == null )
|
if ( map == null )
|
||||||
throw new IllegalArgumentException("no method named '"+methodName+"'");
|
throw new IllegalArgumentException("no method named '"+methodName+"'");
|
||||||
Integer n = Integer.valueOf( params.classes.length );
|
Integer n = new Integer( params.classes.length );
|
||||||
List list = (List) map.get(n);
|
List list = (List) map.get(n);
|
||||||
if ( list == null )
|
if ( list == null )
|
||||||
throw new IllegalArgumentException("no method named '"+methodName+"' with "+n+" args");
|
throw new IllegalArgumentException("no method named '"+methodName+"' with "+n+" args");
|
||||||
|
|||||||
Reference in New Issue
Block a user