Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7622351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:25:45+00:00 2026-05-31T04:25:45+00:00

I will use a specific example to make it easier to understand. Rather than

  • 0

I will use a specific example to make it easier to understand.

Rather than using:

Annotation[] annotations = method.getAnnotations();

I’d like to be able to get an array of the class types associated with each annotation:

Class<?>[] annotationClasses = method.getAnnotationTypes();

Is there a way to override the Method class and add my custom method that will use getAnnotations to collect the annotations, but return the class type instead of an Annotation type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:25:46+00:00Added an answer on May 31, 2026 at 4:25 am

    There is no way to do exactly what you are requesting. Method is final and can not be extended.

    However, you could do

    Class < ? > [ ] getDeclaredAnnotations ( Method method )
    {
           Annotation [ ] as = method . getDeclaredAnnotations ( ) ;
           Class < ? > [ ] bs = new Class < ? > [ as . length ] ;
           for ( int i = 0 ; i < as . length ; i ++ )
           {
                  Annotation a = as [ i ] ;
                  b [ i ] = a ;
           }
           return bs ;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to know what wordpress build-in function you will use when sanitizing specific
I will use quickaction for a listview. I use this example for quickaction: http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
I'm working on a website that will use features of social networking (like facebook
How would you configure annotations in the following example code? I'd like to stick
I've tried to put this in generic terms to make it easier to understand.
This is a high level/design type question rather than anything specific. In this game
I will use (again) the following class hierarchy: Event and all the following classes
I will use the following javascript to display a Google Map Window in a
When we will use DrawItem for a listbox? Normally, if the listbox is ownerdraw,
My script below will use two external tables to fill two separate tables, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.