Java Code Examples for com.sun.org.apache.bcel.internal.classfile.Utility#convertString()

The following examples show how to use com.sun.org.apache.bcel.internal.classfile.Utility#convertString() . 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: BCELFactory.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private void createConstant( final Object value ) {
    String embed = value.toString();
    if (value instanceof String) {
        embed = '"' + Utility.convertString(embed) + '"';
    } else if (value instanceof Character) {
        embed = "(char)0x" + Integer.toHexString(((Character) value).charValue());
    } else if (value instanceof Float) {
        embed += "f";
    } else if (value instanceof Long) {
        embed += "L";
    } else if (value instanceof ObjectType) {
        final ObjectType ot = (ObjectType) value;
        embed = "new ObjectType(\""+ot.getClassName()+"\")";
    }

    _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 2
Source File: BCELFactory.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 3
Source File: BCELFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 4
Source File: BCELFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 5
Source File: BCELFactory.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 6
Source File: BCELFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 7
Source File: BCELFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 8
Source File: BCELFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 9
Source File: BCELFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 10
Source File: BCELFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}
 
Example 11
Source File: BCELFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void createConstant(Object value) {
  String embed = value.toString();

  if(value instanceof String)
    embed = '"' + Utility.convertString(value.toString()) + '"';
  else if(value instanceof Character)
    embed = "(char)0x" + Integer.toHexString(((Character)value).charValue());

  _out.println("il.append(new PUSH(_cp, " + embed + "));");
}