mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8335642: Hide Transform implementation for Class-File API
Reviewed-by: asotona
This commit is contained in:
parent
2b0adfc2de
commit
a253e0ff4b
9 changed files with 66 additions and 136 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
package java.lang.classfile;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
|
||||
|
@ -124,46 +123,4 @@ public sealed interface ClassFileTransform<
|
|||
* @return the chained transform
|
||||
*/
|
||||
C andThen(C next);
|
||||
|
||||
/**
|
||||
* The result of binding a transform to a builder. Used primarily within
|
||||
* the implementation to perform transformation.
|
||||
*
|
||||
* @param <E> the element type
|
||||
*
|
||||
* @since 22
|
||||
*/
|
||||
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
|
||||
interface ResolvedTransform<E extends ClassFileElement> {
|
||||
/**
|
||||
* {@return a {@link Consumer} to receive elements}
|
||||
*/
|
||||
Consumer<E> consumer();
|
||||
|
||||
/**
|
||||
* {@return an action to call at the end of transformation}
|
||||
*/
|
||||
Runnable endHandler();
|
||||
|
||||
/**
|
||||
* {@return an action to call at the start of transformation}
|
||||
*/
|
||||
Runnable startHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a transform to a builder. If the transform is chained, intermediate
|
||||
* builders are created for each chain link. If the transform is stateful
|
||||
* (see, e.g., {@link ClassTransform#ofStateful(Supplier)}), the supplier is
|
||||
* invoked to get a fresh transform object.
|
||||
*
|
||||
* <p>This method is a low-level method that should rarely be used by
|
||||
* user code; most of the time, user code should prefer
|
||||
* {@link ClassFileBuilder#transform(CompoundElement, ClassFileTransform)},
|
||||
* which resolves the transform and executes it on the current builder.
|
||||
*
|
||||
* @param builder the builder to bind to
|
||||
* @return the bound result
|
||||
*/
|
||||
ResolvedTransform<E> resolve(B builder);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue