(Object value, GeneratorAdapter gen)
| 5281 | } |
| 5282 | |
| 5283 | void emitValue(Object value, GeneratorAdapter gen){ |
| 5284 | boolean partial = true; |
| 5285 | //System.out.println(value.getClass().toString()); |
| 5286 | |
| 5287 | if(value == null) |
| 5288 | gen.visitInsn(Opcodes.ACONST_NULL); |
| 5289 | else if(value instanceof String) |
| 5290 | { |
| 5291 | gen.push((String) value); |
| 5292 | } |
| 5293 | else if(value instanceof Boolean) |
| 5294 | { |
| 5295 | if(((Boolean) value).booleanValue()) |
| 5296 | gen.getStatic(BOOLEAN_OBJECT_TYPE, "TRUE", BOOLEAN_OBJECT_TYPE); |
| 5297 | else |
| 5298 | gen.getStatic(BOOLEAN_OBJECT_TYPE,"FALSE",BOOLEAN_OBJECT_TYPE); |
| 5299 | } |
| 5300 | else if(value instanceof Integer) |
| 5301 | { |
| 5302 | gen.push(((Integer) value).intValue()); |
| 5303 | gen.invokeStatic(Type.getType(Integer.class), Method.getMethod("Integer valueOf(int)")); |
| 5304 | } |
| 5305 | else if(value instanceof Long) |
| 5306 | { |
| 5307 | gen.push(((Long) value).longValue()); |
| 5308 | gen.invokeStatic(Type.getType(Long.class), Method.getMethod("Long valueOf(long)")); |
| 5309 | } |
| 5310 | else if(value instanceof Double) |
| 5311 | { |
| 5312 | gen.push(((Double) value).doubleValue()); |
| 5313 | gen.invokeStatic(Type.getType(Double.class), Method.getMethod("Double valueOf(double)")); |
| 5314 | } |
| 5315 | else if(value instanceof Character) |
| 5316 | { |
| 5317 | gen.push(((Character) value).charValue()); |
| 5318 | gen.invokeStatic(Type.getType(Character.class), Method.getMethod("Character valueOf(char)")); |
| 5319 | } |
| 5320 | else if(value instanceof Class) |
| 5321 | { |
| 5322 | Class cc = (Class)value; |
| 5323 | if(cc.isPrimitive()) |
| 5324 | { |
| 5325 | Type bt; |
| 5326 | if ( cc == boolean.class ) bt = Type.getType(Boolean.class); |
| 5327 | else if ( cc == byte.class ) bt = Type.getType(Byte.class); |
| 5328 | else if ( cc == char.class ) bt = Type.getType(Character.class); |
| 5329 | else if ( cc == double.class ) bt = Type.getType(Double.class); |
| 5330 | else if ( cc == float.class ) bt = Type.getType(Float.class); |
| 5331 | else if ( cc == int.class ) bt = Type.getType(Integer.class); |
| 5332 | else if ( cc == long.class ) bt = Type.getType(Long.class); |
| 5333 | else if ( cc == short.class ) bt = Type.getType(Short.class); |
| 5334 | else throw Util.runtimeException( |
| 5335 | "Can't embed unknown primitive in code: " + value); |
| 5336 | gen.getStatic( bt, "TYPE", Type.getType(Class.class) ); |
| 5337 | } |
| 5338 | else |
| 5339 | { |
| 5340 | gen.push(destubClassName(cc.getName())); |
no test coverage detected