Example usage for org.objectweb.asm.signature SignatureWriter visitInterfaceBound

List of usage examples for org.objectweb.asm.signature SignatureWriter visitInterfaceBound

Introduction

In this page you can find the example usage for org.objectweb.asm.signature SignatureWriter visitInterfaceBound.

Prototype

@Override
    public SignatureVisitor visitInterfaceBound() 

Source Link

Usage

From source file:com.pongasoft.kiwidoc.builder.serializer.type.TypeEncoder.java

License:Apache License

/**
 * @return the signature for a given generic type variable
 *//*  w  w w. j a  v a 2 s  .c o  m*/
public String encodeGenericTypeVariables(GenericTypeVariables type) {
    SignatureWriter sw = new SignatureWriter();

    for (GenericTypeVariable gtv : type.getGenericTypeVariables()) {
        sw.visitFormalTypeParameter(gtv.getName());

        List<Type> bounds = gtv.getBounds();
        if (bounds.isEmpty())
            bounds = OBJECT_BOUNDS;
        int i = 0;
        for (Type bound : bounds) {
            SignatureVisitor sv;
            if (i > 0) {
                sv = sw.visitInterfaceBound();
            } else {
                sv = sw.visitClassBound();
            }
            buildType(sv, bound);
            i++;
        }
    }

    // the signature is not complete without visiting the superclass... so we visit it and then
    // we remove it from the signature
    SignatureVisitor sv = sw.visitSuperclass();
    buildType(sv, OBJECT_TYPE);
    String signature = sw.toString();

    signature = signature.substring(0, signature.length() - OBJECT_SIGNATURE_LENGTH);

    return signature;
}