if (javaType == boolean.class) {
Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getBoolean", boolean.class, int.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else if (javaType == long.class) {
Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getLong", long.class, int.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else if (javaType == double.class) {
Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getDouble", double.class, int.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else if (javaType == Slice.class) {
Block isNotNull = new Block(context)
.getVariable("cursor")
.push(channel)
.invokeInterface(RecordCursor.class, "getSlice", Slice.class, int.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else {
throw new UnsupportedOperationException("not yet implemented: " + type);
}
}
else {
Block isNullCheck = new Block(context)
.setDescription(format("channel_%d.get%s()", channel, type))
.getVariable("channel_" + channel)
.invokeInterface(BlockCursor.class, "isNull", boolean.class);
Block isNull = new Block(context)
.putVariable("wasNull", true)
.pushJavaDefault(javaType);
if (javaType == boolean.class) {
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(BlockCursor.class, "getBoolean", boolean.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else if (javaType == long.class) {
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(BlockCursor.class, "getLong", long.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else if (javaType == double.class) {
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(BlockCursor.class, "getDouble", double.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else if (javaType == Slice.class) {
Block isNotNull = new Block(context)
.getVariable("channel_" + channel)
.invokeInterface(BlockCursor.class, "getSlice", Slice.class);
return new IfStatement(context, isNullCheck, isNull, isNotNull);
}
else {
throw new UnsupportedOperationException("not yet implemented: " + type);
}
}