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 6645859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:20:28+00:00 2026-05-26T00:20:28+00:00

Is there some similar feature in Java as ‘attributes’ in Delphi ? Example explanation

  • 0

Is there some similar feature in Java as ‘attributes’ in Delphi ?

Example explanation of Attributes in Delphi:
http://www.malcolmgroves.com/blog/?p=476

Att.

  • 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-26T00:20:29+00:00Added an answer on May 26, 2026 at 12:20 am

    From that article, you’re looking for Java Annotations. They let you do things like:

    @SomeInfo(author = "Bob", year = 1993)
    class Foo {
        @SomeInfo(author = "me", somethingElse = "abcdefg")
        private int x = 5;
    
        @SomeInfo(author = "Fred", column = "order")
        public int getX() {
            return x;
        }
    }
    

    where @SomeInfo is an annotation. They can be applied to classes, fields, and methods, and they carry metadata about the thing they annotate, which can be read at runtime if they have the appropriate retention. E.g:

    @Retention(RetentionPolicy.RUNTIME)
    @interface SomeInfo {
        String author();
        int year() default -1;
        String column() default "";
        String somethingElse() default "";
    }
    
    class Main {
        public static void main(String[] args) throws Exception {
            List<AnnotatedElement> annotatedElements =
                new ArrayList<AnnotatedElement>();
            annotatedElements.add(Foo.class);
            annotatedElements.add(Foo.class.getDeclaredField("x"));
            annotatedElements.add(Foo.class.getDeclaredMethod("getX"));
            for (AnnotatedElement annotatedElement : annotatedElements) {
                System.out.println("Author of {" + annotatedElement + "} = " +
                    annotatedElement.getAnnotation(SomeInfo.class).author());
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there some way I can use URLs like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in
(similar to Resettable Java Timer but there are some subtleties I need to explore)
Is there in Ruby some functionality/syntax to compare two floats with delta? Something similar
There is a similar question here but it only covers some of the issues
Are there some principles of organizing classes into namespaces? For example is it OK
There is a noSuchMethod feature in some javascript implementations (Rhino, SpiderMonkey) proxy = {
There are some other similar questions here but they're fairly old when Rails 3
I see there are some similar questions, but I fail to understand the implementation
There are some similar questions on the topic, but they are not really helping
I have a structure similar to the following: /root/ /root/data/ /root/data/script.php /root/data/some.json /root/data/feature/one.json /root/data/feature/two.json

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.