public void loadConstant(TypeDesc type) throws IllegalStateException { if (type == null) { loadNull(); return; } if (type.isPrimitive()) { if (mTarget < 0x00010001) { throw new IllegalStateException ("Loading constant primitive classes not supported below target version 1.1"); } loadStaticField(type.toObjectType(), "TYPE", TypeDesc.forClass(Class.class)); } else { if (mTarget < 0x00010005) { throw new IllegalStateException ("Loading constant object classes not supported below target version 1.5"); } ConstantInfo info = mCp.addConstantClass(type); mInstructions.new LoadConstantInstruction(1, TypeDesc.forClass(Class.class), info); } }
private void nullConvert(Label end) { LocalVariable temp = createLocalVariable("temp", TypeDesc.OBJECT); storeLocal(temp); loadLocal(temp); Label notNull = createLabel(); ifNullBranch(notNull, false); loadNull(); branch(end); notNull.setLocation(); loadLocal(temp); }
public void loadConstant(String value) { if (value == null) { loadNull(); return;
b.returnValue(TypeDesc.BOOLEAN); } else if (methodType == TRY_READ_METHOD) { b.loadNull(); b.returnValue(TypeDesc.OBJECT); } else {
public void loadConstant(TypeDesc type) throws IllegalStateException { if (type == null) { loadNull(); return; } if (type.isPrimitive()) { if (mTarget < 0x00010001) { throw new IllegalStateException ("Loading constant primitive classes not supported below target version 1.1"); } loadStaticField(type.toObjectType(), "TYPE", TypeDesc.forClass(Class.class)); } else { if (mTarget < 0x00010005) { throw new IllegalStateException ("Loading constant object classes not supported below target version 1.5"); } ConstantInfo info = mCp.addConstantClass(type); mInstructions.new LoadConstantInstruction(1, TypeDesc.forClass(Class.class), info); } }
private void nullConvert(Label end) { LocalVariable temp = createLocalVariable("temp", TypeDesc.OBJECT); storeLocal(temp); loadLocal(temp); Label notNull = createLabel(); ifNullBranch(notNull, false); loadNull(); branch(end); notNull.setLocation(); loadLocal(temp); }
/** * Generates code to push a blank value to the stack. For objects, it is * null, and for primitive types it is zero or false. */ public static void blankValue(CodeBuilder b, TypeDesc type) { switch (type.getTypeCode()) { default: b.loadNull(); break; case TypeDesc.BYTE_CODE: case TypeDesc.CHAR_CODE: case TypeDesc.SHORT_CODE: case TypeDesc.INT_CODE: b.loadConstant(0); break; case TypeDesc.BOOLEAN_CODE: b.loadConstant(false); break; case TypeDesc.LONG_CODE: b.loadConstant(0L); break; case TypeDesc.FLOAT_CODE: b.loadConstant(0.0f); break; case TypeDesc.DOUBLE_CODE: b.loadConstant(0.0); break; } }
/** * Generates code to push a blank value to the stack. For objects, it is * null, and for primitive types it is zero or false. */ public static void blankValue(CodeBuilder b, TypeDesc type) { switch (type.getTypeCode()) { default: b.loadNull(); break; case TypeDesc.BYTE_CODE: case TypeDesc.CHAR_CODE: case TypeDesc.SHORT_CODE: case TypeDesc.INT_CODE: b.loadConstant(0); break; case TypeDesc.BOOLEAN_CODE: b.loadConstant(false); break; case TypeDesc.LONG_CODE: b.loadConstant(0L); break; case TypeDesc.FLOAT_CODE: b.loadConstant(0.0f); break; case TypeDesc.DOUBLE_CODE: b.loadConstant(0.0); break; } }
Label notNull = b.createLabel(); b.ifNullBranch(notNull, false); b.loadNull(); b.returnValue(TypeDesc.OBJECT);
Label notNull = b.createLabel(); b.ifNullBranch(notNull, false); b.loadNull(); b.returnValue(TypeDesc.OBJECT);
if (isAccessor) { b.loadNull(); } else {
if (isAccessor) { b.loadNull(); } else {
private void defineExtractAllMethod(Map<JDBCStorableProperty<S>, Class<?>> lobLoaderMap) throws SupportException { MethodInfo mi = mClassFile.addMethod (Modifiers.PRIVATE, EXTRACT_ALL_METHOD_NAME, null, new TypeDesc[] {TypeDesc.forClass(ResultSet.class), TypeDesc.INT}); CodeBuilder b = new CodeBuilder(mi); defineExtract(b, b.getParameter(0), b.getParameter(1), null, mInfo.getPrimaryKeyProperties().values(), lobLoaderMap); // Invoke extract data method to do the rest. b.loadThis(); // Load the ResultSet var. b.loadLocal(b.getParameter(0)); // The offset variable has already been incremented by code generated // by defineExtract, except for the last property. b.loadLocal(b.getParameter(1)); b.loadConstant(1); b.math(Opcode.IADD); b.loadNull(); // No Lobs to update b.invokePrivate(EXTRACT_DATA_METHOD_NAME, null, new TypeDesc[] {TypeDesc.forClass(ResultSet.class), TypeDesc.INT, TypeDesc.forClass(Lob.class).toArrayType()}); b.returnVoid(); }
private void defineExtractAllMethod(Map<JDBCStorableProperty<S>, Class<?>> lobLoaderMap) throws SupportException { MethodInfo mi = mClassFile.addMethod (Modifiers.PRIVATE, EXTRACT_ALL_METHOD_NAME, null, new TypeDesc[] {TypeDesc.forClass(ResultSet.class), TypeDesc.INT}); CodeBuilder b = new CodeBuilder(mi); defineExtract(b, b.getParameter(0), b.getParameter(1), null, mInfo.getPrimaryKeyProperties().values(), lobLoaderMap); // Invoke extract data method to do the rest. b.loadThis(); // Load the ResultSet var. b.loadLocal(b.getParameter(0)); // The offset variable has already been incremented by code generated // by defineExtract, except for the last property. b.loadLocal(b.getParameter(1)); b.loadConstant(1); b.math(Opcode.IADD); b.loadNull(); // No Lobs to update b.invokePrivate(EXTRACT_DATA_METHOD_NAME, null, new TypeDesc[] {TypeDesc.forClass(ResultSet.class), TypeDesc.INT, TypeDesc.forClass(Lob.class).toArrayType()}); b.returnVoid(); }
b.loadNull(); b.branch(done); notNull.setLocation();
b.loadNull(); b.branch(done); notNull.setLocation();
b.ifNullBranch(notInTxn, true); b.loadNull(); Label storeTxn = b.createLabel(); b.branch(storeTxn);
b.ifNullBranch(notInTxn, true); b.loadNull(); Label storeTxn = b.createLabel(); b.branch(storeTxn);