Skip to content

Instantly share code, notes, and snippets.

@elucidator
Created March 7, 2014 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elucidator/9413055 to your computer and use it in GitHub Desktop.
Save elucidator/9413055 to your computer and use it in GitHub Desktop.
Gist for the NamedPRoperty Annotation
@Retention(RUNTIME)
@Target({FIELD, METHOD})
@Qualifier
public @interface NamedProperty {
/**
* key or name of the property
*
* @return a valid key or ""
*/
@Nonbinding String key() default "";
/**
* Is it a mandatory property. When key is not found in the configuration it
* throws a {{@link java.lang.IllegalArgumentException}}
*
* @return true if mandatory
*/
@Nonbinding boolean mandatory() default false;
/**
* Default value if not provided
*
* @return default value or ""
*/
@Nonbinding String defaultValue() default "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment