Skip to content
forked from matyb/java-koans

A framework and corresponding koans to learn the core Java language, best practices, and TDD

License

Notifications You must be signed in to change notification settings

nurous/java-koans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

A java.util.ResourceBundle replacement for configuration properties. Helpful for metadata to properties for the purpose of validating, inspecting, binding, etc. properties without infringing on any existing useage of those resources.

For example the property:
warning.dialog.alert.icon=/images/w_alert.png

Could be analyzed by acceptance tests or validation code:
#@ location:warning_dialog; resource_type:png-image
warning.dialog.alert.icon=/images/w_alert.png

Now at runtime, the annotated keys and values are available via the AnnotatedResourceBundle class. Keeping with the same example:

AnnotatedResourceBundle annotatedResourceBundle = new AnnotatedResourceBundle(
    "images.properties", getClass().getClassLoader());
for(Entry<String, String> entry : annotatedResourceBundle.getAttributes("warning.dialog.alert.icon").entrySet()){
    System.out.println(entry);
}

would output:
location=warning_dialog
resource_type=png-image

About

A framework and corresponding koans to learn the core Java language, best practices, and TDD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 96.0%
  • Perl 3.8%
  • Other 0.2%