+static JSValueRef JavaClass_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
+ CYJavaClass *internal(reinterpret_cast<CYJavaClass *>(JSObjectGetPrivate(_this)));
+ JNIEnv *jni(internal->value_);
+ jclass Class$(_envcall(jni, FindClass("java/lang/Class")));
+ jmethodID Class$getCanonicalName(_envcall(jni, GetMethodID(Class$, "getCanonicalName", "()Ljava/lang/String;")));
+ return CYCastJSValue(context, CYJSString(jni, static_cast<jstring>(_envcall(jni, CallObjectMethod(internal->value_, Class$getCanonicalName)))));
+} CYCatch(NULL) }
+
+static JSValueRef JavaMethod_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
+ std::ostringstream cyon;
+ return CYCastJSValue(context, CYJSString(cyon.str()));
+} CYCatch(NULL) }
+
+static JSValueRef JavaStaticMethod_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
+ std::ostringstream cyon;
+ return CYCastJSValue(context, CYJSString(cyon.str()));
+} CYCatch(NULL) }
+
+static JSValueRef JavaArray_getProperty(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry {
+ CYJavaArray *internal(reinterpret_cast<CYJavaArray *>(JSObjectGetPrivate(object)));
+ JNIEnv *jni(internal->value_);
+ if (JSStringIsEqual(property, length_s))
+ return CYCastJSValue(context, _envcall(jni, GetArrayLength(internal->value_)));
+
+ CYPool pool;
+ ssize_t offset;
+ if (!CYGetOffset(pool, context, property, offset))
+ return NULL;
+
+ if (internal->primitive_ == CYJavaPrimitiveObject)
+ return CYCastJSValue(context, jni, _envcall(jni, GetObjectArrayElement(static_cast<jobjectArray>(internal->value_.value_), offset)));
+ else switch (internal->primitive_) {
+#define CYJavaForEachPrimitive_(T, t, Typ, Type, type) \
+ case CYJavaPrimitive ## Type: { \
+ j ## type element; \
+ _envcallv(jni, Get ## Typ ## ArrayRegion(static_cast<j ## type ## Array>(internal->value_.value_), offset, 1, &element)); \
+ return CYJavaCastJSValue(context, element); \
+ } break;
+CYJavaForEachPrimitive
+#undef CYJavaForEachPrimitive_
+ default: _assert(false);
+ }
+} CYCatch(NULL) }
+
+static bool JavaArray_setProperty(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef value, JSValueRef *exception) { CYTry {
+ CYJavaArray *internal(reinterpret_cast<CYJavaArray *>(JSObjectGetPrivate(object)));
+ JNIEnv *jni(internal->value_);
+
+ CYPool pool;
+ ssize_t offset;
+ if (!CYGetOffset(pool, context, property, offset))
+ return false;
+
+ if (internal->primitive_ == CYJavaPrimitiveObject)
+ _envcallv(jni, SetObjectArrayElement(static_cast<jobjectArray>(internal->value_.value_), offset, CYCastJavaObject(jni, context, value)));
+ else switch (internal->primitive_) {
+#define CYJavaForEachPrimitive_(T, t, Typ, Type, type) \
+ case CYJavaPrimitive ## Type: { \
+ j ## type element; \
+ _envcallv(jni, Get ## Typ ## ArrayRegion(static_cast<j ## type ## Array>(internal->value_.value_), offset, 1, &element)); \
+ return CYJavaCastJSValue(context, element); \
+ } break;
+CYJavaForEachPrimitive
+#undef CYJavaForEachPrimitive_
+ default: _assert(false);
+ }
+
+ return true;
+} CYCatch(false) }
+
+static JSValueRef JavaPackage_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
+ CYJavaPackage *internal(reinterpret_cast<CYJavaPackage *>(JSObjectGetPrivate(_this)));
+ std::ostringstream name;
+ for (auto &package : internal->package_)
+ name << package << '.';
+ name << '*';
+ return CYCastJSValue(context, CYJSString(name.str()));
+} CYCatch(NULL) }
+