List of usage examples for org.objectweb.asm.signature SignatureVisitor visitTypeVariable
public void visitTypeVariable(final String name)
From source file:co.cask.cdap.internal.io.FieldAccessorGenerator.java
License:Apache License
/** * @return the getter signature {@code <T> T get(Object object)} *///from w ww . j av a 2s . c o m 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(); }
From source file:co.cask.cdap.internal.io.FieldAccessorGenerator.java
License:Apache License
/** * @return the setter signature {@code <T> void set(Object object, T value)} *///w w w . j a va 2s . c om 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(); }
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. ja v a2s . co 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()); }