Example usage for org.objectweb.asm.signature SignatureVisitor visitInnerClassType

List of usage examples for org.objectweb.asm.signature SignatureVisitor visitInnerClassType

Introduction

In this page you can find the example usage for org.objectweb.asm.signature SignatureVisitor visitInnerClassType.

Prototype

public void visitInnerClassType(final String name) 

Source Link

Document

Visits an inner class.

Usage

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

License:Apache License

private void buildType(SignatureVisitor sv, Type type) {
    if (type instanceof PrimitiveType) {
        PrimitiveType primitiveType = (PrimitiveType) type;
        sv.visitBaseType(EnumCodec.INSTANCE.encode(primitiveType.getPrimitive()).charAt(0));
        return;/*from w  w w .jav  a2  s .  c  o  m*/
    }

    if (type instanceof GenericVariable) {
        GenericVariable genericVariable = (GenericVariable) type;
        sv.visitTypeVariable(genericVariable.getName());
        return;
    }

    if (type instanceof ArrayType) {
        ArrayType arrayType = (ArrayType) type;
        for (int i = 0; i < arrayType.getDimension(); i++)
            sv = sv.visitArrayType();
        buildType(sv, arrayType.getType());
        return;
    }

    if (type instanceof GenericType) {
        GenericType genericType = (GenericType) type;
        int i = 0;
        for (TypePart typePart : genericType.getTypeParts()) {
            if (i == 0) {
                sv.visitClassType(ClassResource.computeInternalName(typePart.getName()));
            } else {
                sv.visitInnerClassType(typePart.getName());
            }
            i++;
            buildGenericType(sv, typePart.getGenerics());
        }
        sv.visitEnd();
        return;
    }

    if (type instanceof UnresolvedType) {
        UnresolvedType unresolvedType = (UnresolvedType) type;
        sv.visitClassType(unresolvedType.getInternalName());
        sv.visitEnd();
        return;
    }

    throw new RuntimeException("unsupported type here..." + type.getClass().getName());
}