All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mockit.asm.constantPool.AttributeWriter Maven / Gradle / Ivy

Go to download

JMockit is a Java toolkit for automated developer testing. It contains mocking/faking APIs and a code coverage tool, supporting both JUnit and TestNG. The mocking APIs allow all kinds of Java code, without testability restrictions, to be tested in isolation from selected dependencies.

There is a newer version: 1.49
Show newest version
package mockit.asm.constantPool;

import javax.annotation.*;

import mockit.asm.util.*;

public abstract class AttributeWriter
{
   @Nonnull protected final ConstantPoolGeneration cp;

   /**
    * The index of the constant pool item that contains the name of the associated attribute.
    */
   @Nonnegative protected int attributeIndex;

   protected AttributeWriter(@Nonnull ConstantPoolGeneration cp) { this.cp = cp; }

   protected AttributeWriter(@Nonnull ConstantPoolGeneration cp, @Nonnull String attributeName) {
      this.cp = cp;
      setAttribute(attributeName);
   }

   protected final void setAttribute(@Nonnull String attributeName) {
      attributeIndex = cp.newUTF8(attributeName);
   }

   @Nonnegative
   public abstract int getSize();

   public void put(@Nonnull ByteVector out) {
      put(out, 2);
   }

   protected final void put(@Nonnull ByteVector out, @Nonnegative int size) {
      out.putShort(attributeIndex).putInt(size);
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy