/// <summary>Makes the given visitor visit a given annotation value.</summary> /// <param name="annotationVisitor"> /// an annotation visitor. Maybe /// <literal>null</literal> /// . /// </param> /// <param name="name">the value name.</param> /// <param name="value">the actual value.</param> internal static void Accept(AnnotationVisitor annotationVisitor, string name, object value) { if (annotationVisitor != null) { if (value is string[]) { var typeValue = (string[])value; annotationVisitor.VisitEnum(name, typeValue[0], typeValue[1]); } else if (value is AnnotationNode) { var annotationValue = (AnnotationNode)value; annotationValue.Accept(annotationVisitor.VisitAnnotation(name, annotationValue.desc )); } else if (value is IList) { var arrayAnnotationVisitor = annotationVisitor.VisitArray(name); if (arrayAnnotationVisitor != null) { var arrayValue = (IList <object>)value; for (int i = 0, n = arrayValue.Count; i < n; ++i) { Accept(arrayAnnotationVisitor, null, arrayValue[i]); } arrayAnnotationVisitor.VisitEnd(); } } else { annotationVisitor.Visit(name, value); } } }
/// <summary> /// Constructs a new /// <see cref="AnnotationRemapper" /> /// . /// </summary> /// <param name="api"> /// the ASM API version supported by this remapper. Must be one of /// <see cref="Opcodes.Asm4" /> /// , /// <see cref="Opcodes.Asm5" /> /// or /// <see cref="Opcodes.Asm6" /> /// . /// </param> /// <param name="annotationVisitor"> /// the annotation visitor this remapper must deleted to. /// </param> /// <param name="remapper"> /// the remapper to use to remap the types in the visited annotation. /// </param> protected internal AnnotationRemapper(VisitorAsmApiVersion api, AnnotationVisitor annotationVisitor , Remapper remapper) : base(api, annotationVisitor) { /* latest api = */ this.remapper = remapper; }
internal CheckAnnotationAdapter(AnnotationVisitor annotationVisitor, bool useNamedValues ) : base(VisitorAsmApiVersion.Asm7, annotationVisitor) { /* latest api = */ useNamedValue = useNamedValues; }
/// <summary> /// Constructs a new /// <see cref="TraceAnnotationVisitor" /> /// . /// </summary> /// <param name="annotationVisitor"> /// the annotation visitor to which to delegate calls. May be /// <literal>null</literal> /// . /// </param> /// <param name="printer">the printer to convert the visited annotation into text.</param> public TraceAnnotationVisitor(AnnotationVisitor annotationVisitor, Printer printer ) : base(VisitorAsmApiVersion.Asm7, annotationVisitor) { /* latest api = */ this.printer = printer; }
// nothing to do /// <summary>Makes the given visitor visit this annotation.</summary> /// <param name="annotationVisitor"> /// an annotation visitor. Maybe /// <literal>null</literal> /// . /// </param> public virtual void Accept(AnnotationVisitor annotationVisitor) { if (annotationVisitor != null) { if (values != null) { for (int i = 0, n = values.Count; i < n; i += 2) { var name = (string)values[i]; var value = values[i + 1]; Accept(annotationVisitor, name, value); } } annotationVisitor.VisitEnd(); } }
/// <summary> /// Constructs a new /// <see cref="AnnotationRemapper" /> /// . <i>Subclasses must not use this constructor</i>. /// Instead, they must use the /// <see cref="AnnotationRemapper(VisitorAsmApiVersion, AnnotationVisitor, Remapper) /// " /> /// version. /// </summary> /// <param name="annotationVisitor"> /// the annotation visitor this remapper must deleted to. /// </param> /// <param name="remapper"> /// the remapper to use to remap the types in the visited annotation. /// </param> public AnnotationRemapper(AnnotationVisitor annotationVisitor, Remapper remapper) : this(VisitorAsmApiVersion.Asm7, annotationVisitor, remapper) { }
/// <summary>Constructs a new remapper for annotations.</summary> /// <remarks> /// Constructs a new remapper for annotations. The default implementation of this method returns a /// new /// <see cref="AnnotationRemapper" /> /// . /// </remarks> /// <param name="annotationVisitor"> /// the AnnotationVisitor the remapper must delegate to. /// </param> /// <returns>the newly created remapper.</returns> protected internal virtual AnnotationVisitor CreateAnnotationRemapper(AnnotationVisitor annotationVisitor) { return(new AnnotationRemapper(api, annotationVisitor, remapper)); }
override void accept(String name, AnnotationVisitor visitor) { visitor.visit(name, AsmType.getType(type.Descriptor)); }
override void accept(String name, AnnotationVisitor visitor) { visitor.visitEnum(name, type.Descriptor, this.name); }
override void accept(String name, AnnotationVisitor visitor) { var v = visitor.visitArray(name); foreach (var e in elements) { e.accept("", v); } v.visitEnd(); }
override void accept(String name, AnnotationVisitor visitor) { visitor.visit(name, value); }
void accept(AnnotationVisitor visitor) { foreach (var e in arguments.entrySet()) { e.Value.accept(e.Key, visitor); } visitor.visitEnd(); }
override void accept(String name, AnnotationVisitor visitor) { var v = visitor.visitAnnotation(name, type.Descriptor); foreach (var e in arguments.entrySet()) { e.Value.accept(e.Key, v); } v.visitEnd(); }
public CheckAnnotationAdapter(AnnotationVisitor annotationVisitor) : this(annotationVisitor, true) { }