com.sun.jdi.CharValue Java Examples
The following examples show how to use
com.sun.jdi.CharValue.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CharacterFormatterTest.java From java-debug with Eclipse Public License 1.0 | 6 votes |
@Test public void testValueOf() throws Exception { Map<String, Object> options = formatter.getDefaultOptions(); Value charVar = getVM().mirrorOf('c'); Value newValue = formatter.valueOf("M", charVar.type(), options); assertTrue("should return char type", newValue instanceof CharValue); assertEquals("should return char 'M'", 'M', ((CharValue)newValue).value()); newValue = formatter.valueOf("'N'", charVar.type(), options); assertTrue("should return char type", newValue instanceof CharValue); assertEquals("should return char 'N'", 'N', ((CharValue)newValue).value()); newValue = formatter.valueOf("?", charVar.type(), options); assertTrue("should return char type", newValue instanceof CharValue); assertEquals("should return char '?", '?', ((CharValue)newValue).value()); newValue = formatter.valueOf("/", charVar.type(), options); assertTrue("should return char type", newValue instanceof CharValue); assertEquals("should return char '/'", '/', ((CharValue)newValue).value()); newValue = formatter.valueOf("'", charVar.type(), options); assertTrue("should return char type", newValue instanceof CharValue); assertEquals("should return char '", '\'', ((CharValue)newValue).value()); }
Example #2
Source File: DecisionProcedureGuidanceJDI.java From jbse with GNU General Public License v3.0 | 6 votes |
@Override public Object getValue(Symbolic origin) throws GuidanceException { final com.sun.jdi.Value val = (com.sun.jdi.Value) getJDIValue(origin); if (val instanceof IntegerValue) { return this.calc.valInt(((IntegerValue) val).intValue()); } else if (val instanceof BooleanValue) { return this.calc.valBoolean(((BooleanValue) val).booleanValue()); } else if (val instanceof CharValue) { return this.calc.valChar(((CharValue) val).charValue()); } else if (val instanceof ByteValue) { return this.calc.valByte(((ByteValue) val).byteValue()); } else if (val instanceof DoubleValue) { return this.calc.valDouble(((DoubleValue) val).doubleValue()); } else if (val instanceof FloatValue) { return this.calc.valFloat(((FloatValue) val).floatValue()); } else if (val instanceof LongValue) { return this.calc.valLong(((LongValue) val).longValue()); } else if (val instanceof ShortValue) { return this.calc.valShort(((ShortValue) val).shortValue()); } else if (val instanceof ObjectReference) { return val; } else { //val instanceof VoidValue || val == null return null; } }
Example #3
Source File: AbstractVariable.java From netbeans with Apache License 2.0 | 5 votes |
static String getValue (Value v) { if (v == null) { return "null"; } if (v instanceof VoidValue) { return "void"; } if (v instanceof CharValue) { return "\'" + v.toString () + "\'"; } if (v instanceof PrimitiveValue) { return v.toString (); } try { if (v instanceof StringReference) { String str = ShortenedStrings.getStringWithLengthControl((StringReference) v); return "\"" + str + "\""; } if (v instanceof ClassObjectReference) { return "class " + ReferenceTypeWrapper.name(ClassObjectReferenceWrapper.reflectedType((ClassObjectReference) v)); } if (v instanceof ArrayReference) { return "#" + ObjectReferenceWrapper.uniqueID((ArrayReference) v) + "(length=" + ArrayReferenceWrapper.length((ArrayReference) v) + ")"; } return "#" + ObjectReferenceWrapper.uniqueID((ObjectReference) v); } catch (InternalExceptionWrapper iex) { return ""; } catch (ObjectCollectedExceptionWrapper oex) { return ""; } catch (VMDisconnectedExceptionWrapper dex) { return ""; } }