org.fuin.objects4j
Class LabelFieldInfo

java.lang.Object
  extended by org.fuin.objects4j.LabelInfo
      extended by org.fuin.objects4j.LabelFieldInfo

@Immutable
public final class LabelFieldInfo
extends LabelInfo

Label information for a field of a class.


Constructor Summary
LabelFieldInfo(java.lang.reflect.Field field, java.lang.String text, java.lang.String shortText)
          Constructor with field, text and abbreviation.
 
Method Summary
static java.util.List<LabelFieldInfo> create(java.lang.Class<?> clasz, java.util.Locale locale)
          Returns label informations for all field of a class that are annotated with Label.
static LabelFieldInfo create(java.lang.reflect.Field field, java.util.Locale locale)
          Returns the label information for a given field of a class.
 boolean equals(java.lang.Object obj)
           
 java.lang.reflect.Field getField()
          Returns the field.
 java.lang.String getTextOrField()
          Returns the text of the label or the name of the field if the text is null.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class org.fuin.objects4j.LabelInfo
getResourceBundle, getShortText, getShortText, getText, getText, toNullableString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelFieldInfo

@Requires(value="field != null")
public LabelFieldInfo(java.lang.reflect.Field field,
                                    java.lang.String text,
                                    java.lang.String shortText)
Constructor with field, text and abbreviation.

Parameters:
field - The field.
text - Text.
shortText - Abbreviation of the text.
Method Detail

getField

@Ensures(value="\result != null")
public final java.lang.reflect.Field getField()
Returns the field.

Returns:
Field.

getTextOrField

@Ensures(value="\result != null")
public final java.lang.String getTextOrField()
Returns the text of the label or the name of the field if the text is null.

Returns:
Long text or field name.

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

create

@Requires(value="(clasz != null) && (locale != null)")
@Ensures(value="\result != null")
public static java.util.List<LabelFieldInfo> create(java.lang.Class<?> clasz,
                                                                               java.util.Locale locale)
Returns label informations for all field of a class that are annotated with Label. All other fields ar ignored.

Parameters:
clasz - Class that contains the fields.
locale - Locale to use.
Returns:
List of label informations.

create

@Requires(value="(field != null) && (locale != null)")
public static LabelFieldInfo create(java.lang.reflect.Field field,
                                                  java.util.Locale locale)
Returns the label information for a given field of a class.

Parameters:
field - Field within the class.
locale - Locale to use.
Returns:
Label information or null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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