Skip to content

ClassBuilder Api

qtiuto edited this page Feb 16, 2019 · 5 revisions

Java doc is here. Class Builder is imported default to support dynamic class generation. Lua function callback rule is the same as proxy.Any lua function that have multi-returned results will only have the first result returned as the java result. e.g.

 local jutils= require 'jutils'
 jutils.classBuilder.declare().addMethod("run","V",function () print "ggg" end)
.newInstance(class("Object")()).run()

All type arguments can only be string or class though they're specified as Object.

For Annotation, it's represented by a table(in java Map<Object,Object>), the annotation class can be the table[1] or table.type. The rest fields for the annotation are searched in the table. If table[2] is not nil,then it's set as the value field for the annotation. Static values for the annotation field can only be string,class,primitive types, or enum

Lua Function should be generated for a real lua function rather than from a java implementation.

It doesn't support generating static methods or constructors cause class object won't be freed in dalvik. When the mini sdk version of this project turn to 21, I will add support for them.

Clone this wiki locally