Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptor annotation #16

Open
wsargent opened this issue Sep 28, 2017 · 0 comments
Open

Descriptor annotation #16

wsargent opened this issue Sep 28, 2017 · 0 comments

Comments

@wsargent
Copy link

wsargent commented Sep 28, 2017

One of the useful things about descriptors is they can specify default values, min and max value and useful metadata on attributes:

It'd be nice to have an annotation that could represent this next to an attribute. There is an immutable descriptor used for sort, but not the general purpose descriptor values.

https://github.com/uklimaschewski/JMXWrapper/blob/master/src/com/udojava/jmx/wrapper/JMXBeanWrapper.java#L567

For example, using the DescriptorKey meta-annotation someone may define a Units("inches") annotation

@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Units {
    @DescriptorKey("units")
    String value();
}

And JMXWrapper could then pick up the annotation on attribute and add it to the descriptor at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant