String conditional = field.getConditional();
if (conditional!=null) {
outputln("#if "+conditional);
}
JNIType type = field.getType(), type64 = field.getType64();
boolean allowConversion = !type.equals(type64);
String simpleName = type.getSimpleName();
String accessor = field.getAccessor();
if (accessor == null || accessor.length() == 0)
accessor = field.getName();
String fieldId = "(*env)->GetStaticFieldID(env, that, \""+field.getName()+"\", \""+type.getTypeSignature(allowConversion)+"\")";
if (isCPP) {
fieldId = "env->GetStaticFieldID(that, \""+field.getName()+"\", \""+type.getTypeSignature(allowConversion)+"\")";
}
if (type.isPrimitive()) {
if (isCPP) {
output("\tenv->SetStatic"+type.getTypeSignature1(allowConversion)+"Field(that, "+fieldId +", ");
} else {
output("\t(*env)->SetStatic"+type.getTypeSignature1(allowConversion)+"Field(env, that, "+fieldId +", ");
}
output("("+type.getTypeSignature2(allowConversion)+")");
if( field.isPointer() ) {
output("(intptr_t)");
}
output(accessor);
output(");");
} else if (type.isArray()) {
JNIType componentType = type.getComponentType(), componentType64 = type64.getComponentType();
if (componentType.isPrimitive()) {
outputln("\t{");
output("\t");
output(type.getTypeSignature2(allowConversion));
output(" lpObject1 = (");
output(type.getTypeSignature2(allowConversion));
if (isCPP) {
output(")env->GetStaticObjectField(that, ");
} else {
output(")(*env)->GetStaticObjectField(env, that, ");
}
output(field.getDeclaringClass().getSimpleName());
output(fieldId);
outputln(");");
if (isCPP) {
output("\tenv->Set");
} else {
output("\t(*env)->Set");
}
output(componentType.getTypeSignature1(!componentType.equals(componentType64)));
if (isCPP) {
output("ArrayRegion(lpObject1, 0, sizeof(");
} else {
output("ArrayRegion(env, lpObject1, 0, sizeof(");
}
output(accessor);
output(")");
if (!componentType.isType("byte")) {
output(" / sizeof(");
output(componentType.getTypeSignature2(!componentType.equals(componentType64)));
output(")");
}
output(", (");
output(type.getTypeSignature4(allowConversion, false));
output(")");