Examples of SignatureWriter


Examples of org.objectweb.asm.signature.SignatureWriter

  /**
   * @return the setter signature {@code <T> void set(Object object, T value)}
   */
  private String setterSignature() {
    SignatureWriter writer = new SignatureWriter();
    writer.visitFormalTypeParameter("T");
    SignatureVisitor sv = writer.visitClassBound();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();

    sv = writer.visitParameterType();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();

    sv = writer.visitParameterType();
    sv.visitTypeVariable("T");

    sv.visitReturnType().visitBaseType('V');

    return writer.toString();
  }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

                String superName,
                String[] interfaces)
            {
                if (signature != null) {
                    SignatureReader sr = new SignatureReader(signature);
                    SignatureWriter sw = new SignatureWriter();
                    sr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.CLASS_SIGNATURE,
                            sw));
                    assertEquals(signature, sw.toString());
                }
            }

            public FieldVisitor visitField(
                int access,
                String name,
                String desc,
                String signature,
                Object value)
            {
                if (signature != null) {
                    SignatureReader sr = new SignatureReader(signature);
                    SignatureWriter sw = new SignatureWriter();
                    sr.acceptType(new CheckSignatureAdapter(CheckSignatureAdapter.TYPE_SIGNATURE,
                            sw));
                    assertEquals(signature, sw.toString());
                }
                return null;
            }

            public MethodVisitor visitMethod(
                int access,
                String name,
                String desc,
                String signature,
                String[] exceptions)
            {
                if (signature != null) {
                    SignatureReader sr = new SignatureReader(signature);
                    SignatureWriter sw = new SignatureWriter();
                    sr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.METHOD_SIGNATURE,
                            sw));
                    assertEquals(signature, sw.toString());
                }
                return null;
            }

        }, 0);
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

        super("testSignature");
        this.data = data;
    }

    public void testSignature() {
        SignatureWriter wrt = new SignatureWriter();
        SignatureReader rdr = new SignatureReader(data.signature);
        switch (data.type) {
            case 'C':
            case 'M':
                rdr.accept(wrt);
                break;
            case 'F':
                rdr.acceptType(wrt);
                break;
            default:
                return;
        }
        assertEquals(data.signature, wrt.toString());
    }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

        super("checkSignature");
        this.data = data;
    }

    public void checkSignature() {
        SignatureWriter wrt = new SignatureWriter();
        SignatureReader rdr = new SignatureReader(data.signature);
        switch (data.type) {
            case 'C':
                rdr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.CLASS_SIGNATURE,
                        wrt));
                break;
            case 'M':
                rdr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.METHOD_SIGNATURE,
                        wrt));
                break;
            case 'F':
                rdr.acceptType(new CheckSignatureAdapter(CheckSignatureAdapter.TYPE_SIGNATURE,
                        wrt));
                break;
            default:
                return;
        }
        assertEquals(data.signature, wrt.toString());
    }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

  private String translateSignature(final String signature, boolean type) {
    if (signature == null) {
      return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter() {
        public void visitClassType(final String name) {
          String n = translator.getClassMirrorTranslation(name);
          super.visitClassType(n);
        }
    };

    if (type) {
      r.acceptType(w);   
    } else {
      r.accept(w);   
    }
    return w.toString();
  }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

   *
   * @param delegateType Type of the user http handler
   * @return The signature string
   */
  private String getClassSignature(TypeToken<?> delegateType) {
    SignatureWriter writer = new SignatureWriter();

    // Construct the superclass signature as "AbstractHttpHandlerDelegator<UserHandlerClass>"
    SignatureVisitor sv = writer.visitSuperclass();
    sv.visitClassType(Type.getInternalName(AbstractHttpHandlerDelegator.class));
    SignatureVisitor tv = sv.visitTypeArgument('=');
    tv.visitClassType(Type.getInternalName(delegateType.getRawType()));
    tv.visitEnd();
    sv.visitEnd();

    return writer.toString();
  }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

      if (signature == null) {
        return null;
      }

      SignatureReader reader = new SignatureReader(signature);
      SignatureWriter writer = new SignatureWriter() {
        @Override
        public void visitClassType(String name) {
          if (name.equals(Type.getInternalName(HttpServiceRequest.class))) {
            super.visitClassType(Type.getInternalName(HttpRequest.class));
            return;
          }
          if (name.equals(Type.getInternalName(HttpServiceResponder.class))) {
            super.visitClassType(Type.getInternalName(HttpResponder.class));
            return;
          }
          super.visitClassType(name);
        }
      };
      reader.accept(writer);

      return writer.toString();
    }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

    public String mapSignature(String signature, boolean typeSignature) {
        if (signature == null) {
            return null;
        }
        SignatureReader r = new SignatureReader(signature);
        SignatureWriter w = new SignatureWriter();
        SignatureVisitor a = createRemappingSignatureAdapter(w);
        if (typeSignature) {
            r.acceptType(a);
        } else {
            r.accept(a);
        }
        return w.toString();
    }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

  /**
   * @return the getter signature {@code <T> T get(Object object)}
   */
  private String getterSignature() {
    SignatureWriter writer = new SignatureWriter();
    writer.visitFormalTypeParameter("T");
    SignatureVisitor sv = writer.visitClassBound();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();

    sv = writer.visitParameterType();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();

    sv = sv.visitReturnType();
    sv.visitTypeVariable("T");

    return writer.toString();
  }
View Full Code Here

Examples of org.objectweb.asm.signature.SignatureWriter

  /**
   * @return the setter signature {@code <T> void set(Object object, T value)}
   */
  private String setterSignature() {
    SignatureWriter writer = new SignatureWriter();
    writer.visitFormalTypeParameter("T");
    SignatureVisitor sv = writer.visitClassBound();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();

    sv = writer.visitParameterType();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();

    sv = writer.visitParameterType();
    sv.visitTypeVariable("T");

    sv.visitReturnType().visitBaseType('V');

    return writer.toString();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.