Package org.jboss.modules

# Interface ClassTransformer

All Known Implementing Classes:
  `JLIClassTransformer`

public interface ClassTransformer
A class file transformer which operates on byte buffers.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ClassTransformer`
`IDENTITY`
The identity transformation, which does not modify the class bytes at all.

## Method Summary

Modifier and Type
Method
Description
`static ClassTransformer`
`allOf(Collection<? extends ClassTransformer> transformers)`
Get a new transformer which applies all the transformations in the given collection.
`default ClassTransformer`
`andThen(ClassTransformer other)`
Get a new transformer which applies this transformation followed by another transformation.
`ByteBuffer`
`transform(ClassLoader loader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes)`
Transform the bytes of a class.

## Field Details

### IDENTITY

static final ClassTransformer IDENTITY
The identity transformation, which does not modify the class bytes at all.

## Method Details

### transform

ByteBuffer transform(ClassLoader loader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) throws IllegalArgumentException
Transform the bytes of a class. The position and limit of both the passed-in and returned buffers must mark the start and end of the class bytes.

Parameters:
  `loader` - the class loader of the class being transformed
  `className` - the internal name of the class being transformed (not `null`)
  `protectionDomain` - the protection domain of the class, if any
  `classBytes` - the class bytes being transformed (not `null`; may be a direct or heap buffer)
Returns:
  the transformation result (may be a direct or heap buffer)
Throws:
  `IllegalArgumentException` - if the class could not be transformed for some reason

### andThen

default ClassTransformer andThen(ClassTransformer other)
Get a new transformer which applies this transformation followed by another transformation.

Parameters:
  `other` - the other transformation (must not be `null`)
Returns:
  the new transformer (not `null`)

### allOf

static ClassTransformer allOf(Collection<? extends ClassTransformer> transformers)
Get a new transformer which applies all the transformations in the given collection. The collection should either be immutable or safe for concurrent iteration. A synchronized collection is insufficiently thread-safe.

Parameters:
  `transformers` - the transformer collection (must not be `null`)
Returns:
  the new transformer (not `null`)