java - ByteBuddy and annotations -


i have bunch of webservices running on plain jdk , need intercept public methods in order something. methods using @webparam annotation. subclassing webservice bytebuddy drops @webparam annotation overriding method , service doesn't work anymore expected.

here's sample signature

public fetch( @webparam( name="query" ) querycriteria query ) 

and here's how i'm using bytebuddy

new bytebuddy( )     .subclass( implementationclass )     .method( ispublic( ).and( isdeclaredby( implementationclass ) ) )     .intercept(              methoddelegation.to( new webserviceinterceptor( ) )             .andthen( supermethodcall.instance ) )     .annotatetype( implementationclass.getannotations( ) )     .make( ) 

i know there's way annotate parameters, requires special knowledge method parameters (because params annotated). i'd ask bytebuddy annotate class same way superclass including parameters of overridden methods.

subclass( implementationclass ) .annotatetype( like_superclass ) .method( ) .intercept( ... ) .annotatemethod( like_super_including_params ) 

any ideas?

br, paci

managed find solution myself.

new bytebuddy( )     .withattribute( new typeattributeappender.forinstrumentedtype( annotationappender.valuefilter.appenddefaults.instance ) )     .withdefaultmethodattributeappender( new methodattributeappender.forinstrumentedmethod(annotationappender.valuefilter.appenddefaults.instance ) ) 

will trick.

br, paci


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -