org.fuin.utils4swing.annotations
Class AnnotationUtils

java.lang.Object
  extended by org.fuin.utils4swing.annotations.AnnotationUtils

public final class AnnotationUtils
extends java.lang.Object

Helper methods for annotation.


Method Summary
static java.lang.String getLabelText(java.lang.Class clasz, java.lang.String fieldName, Label label, java.util.Locale locale)
          Retrieve the text for a field with a @Label annotation.
static java.lang.String getStandardText(java.lang.Class clasz, java.lang.String fieldName, java.util.Locale locale)
          Try to read the text for a field that is NOT annotated with @Label from a resource bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLabelText

public static java.lang.String getLabelText(java.lang.Class clasz,
                                            java.lang.String fieldName,
                                            Label label,
                                            java.util.Locale locale)
Retrieve the text for a field with a @Label annotation.

Parameters:
clasz - Class containing the field with the @Label annotation - Cannot be null.
fieldName - Name of the field annotated with @Label - Cannot be null.
label - Label the field is annotated with - Cannot be null.
locale - Locale to use - Cannot be null.
Returns:
Text to display for the field.

getStandardText

public static java.lang.String getStandardText(java.lang.Class clasz,
                                               java.lang.String fieldName,
                                               java.util.Locale locale)
Try to read the text for a field that is NOT annotated with @Label from a resource bundle. The resource bundle is expected to be in the same package and has the same name as clasz. Example: For "org.fuin.example.MyClass" the resource bundle is something like "/org/fuin/example/MyClass.properties" or "/org/fuin/example/MyClass_en.properties". The fieldName is used as key within the resource bundle. If the key is not found fieldName is returned itself.

Parameters:
clasz - Class with the field - Cannot be null.
fieldName - Field within the class - Cannot be null.
locale - Locale to use - Cannot be null.
Returns:
Text to display for the field.


Copyright © 2010 Future Invent Informationsmanagement GmbH. All Rights Reserved.