How to remove/replace existing annotations?
See original GitHub issueThank you for this wonderful library. However, I am stuck at one point. I am able to add annotations to a field/method, but not able to replace or remove existing annotation.
I have the following requirement, on a method,
@OneToOne (fetch = FetchType.LAZY) // I want to remove / replace annotation values
public Employee getEmployee()
I would like to,
- Remove the existing annotation
@OneToOne (fetch = FetchType.LAZY)
- Replace the existing annotation’s values with
@OneToOne (fetch = FetchType.EAGER)
I am using the bytebuddy maven plugin, using the DynamicType.Builder
to visit
the method to add new annotation using MemberAttributeExtension.ForMethod().annotateMethod()
, but not sure how to remove or replace existing annotations.
I tried using MemberSubstitution
, but did not get that to work for removing / replacing annotations
For your help I will be immensely grateful.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
AspectJ: How to replace an existing annotation - Stack Overflow
Using AspectJ, how do you replace an existing annotation? I have the following code declare @method : @Test * *(..) : @Test(timeout ...
Read more >How To Replace Annotations with Cards and End Screens
Compatibility with desktop, mobile, and other viewing platforms made cards and end screens clear winners over annotations.
Read more >Removing annotations
Right-click on the annotation icon in the document, and click Remove Annotation. Save the changes to a new document by clicking the menu...
Read more >Find and Replace Annotation - SOLIDWORKS Utilities
This utility is most useful when multiple annotations need to be corrected or changed at one time. This can be a part, assembly,...
Read more >Find and Replace Annotation - 2019 - SolidWorks Web Help
Finding and Replacing Annotations · For Find What, type the text to find or select it from the drop-down list if you previously...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, glad you like it. Member removal is unfortunately not supported overly well. You’d need to register a
AsmClassVisitorWrapper
and override thevisitAnnotation
method to returnnull
if such an annotation is discovered.thank you @raphw. I was able to make some progress with your inputs.