org.fuin.objects4j
Class RenderFieldInfo

java.lang.Object
  extended by org.fuin.objects4j.RenderFieldInfo

@Immutable
public final class RenderFieldInfo
extends Object

Container for all information that is available to render a field of a class.


Constructor Summary
RenderFieldInfo(Field field, LabelFieldInfo labelFieldInfo, TextFieldInfo textFieldInfo, TableColumnInfo tableColumnInfo)
          Constructor with all data.
 
Method Summary
static RenderFieldInfo create(Field field, Locale locale)
          Creates the render information for a given field.
 boolean equals(Object obj)
           
<A extends Annotation>
A
find(Class<A> type)
          Tries to find an annotation of a given type on this field.
static
<A extends Annotation>
A
find(Class<A> type, Annotation[] annotations, List<Class<? extends Annotation>> alreadyProcessed)
          Tries to find an annotation of a given type within a list of annotations.
 Field getField()
          Returns the field.
 LabelFieldInfo getLabelFieldInfo()
          Returns the label information.
 String getLabelText()
          Returns the label text.
 Long getMaxLength()
          Returns the maximum length of the field.
 Long getMinLength()
          Returns the minimum length of the field.
 TableColumnInfo getTableColumnInfo()
          Returns the table column information.
 TextFieldInfo getTextFieldInfo()
          Returns the text field information.
 int hashCode()
           
 boolean isPasswordField()
          Returns if this is a password field.
 boolean isRequired()
          Returns if this is a reuired field.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderFieldInfo

@Requires(value="field != null")
public RenderFieldInfo(Field field,
                                     LabelFieldInfo labelFieldInfo,
                                     TextFieldInfo textFieldInfo,
                                     TableColumnInfo tableColumnInfo)
Constructor with all data.

Parameters:
field - The field.
labelFieldInfo - Label information.
textFieldInfo - Text field information.
tableColumnInfo - Table column information.
Method Detail

getField

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

Returns:
Field.

getLabelFieldInfo

public final LabelFieldInfo getLabelFieldInfo()
Returns the label information.

Returns:
Information or null.

getTextFieldInfo

public final TextFieldInfo getTextFieldInfo()
Returns the text field information.

Returns:
Information or null.

getTableColumnInfo

public final TableColumnInfo getTableColumnInfo()
Returns the table column information.

Returns:
Information or null.

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

equals

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

isPasswordField

public final boolean isPasswordField()
Returns if this is a password field.

Returns:
If a PasswordStr annotation is present true, else false.

isRequired

public final boolean isRequired()
Returns if this is a reuired field.

Returns:
If a NotNull annotation is present true, else false.

getLabelText

@Ensures(value="\result != null")
public final String getLabelText()
Returns the label text.

Returns:
Label text or name of the field.

getMinLength

public final Long getMinLength()
Returns the minimum length of the field.

Returns:
Min length or null if undefined.

getMaxLength

public final Long getMaxLength()
Returns the maximum length of the field.

Returns:
Max length or null if undefined.

find

public final <A extends Annotation> A find(Class<A> type)
Tries to find an annotation of a given type on this field. The search is recursive - Annotations that have annotations are also checked.

Type Parameters:
A - Type of the annotation.
Parameters:
type - Annotation class.
Returns:
Annotation found or null.

find

public static <A extends Annotation> A find(Class<A> type,
                                            Annotation[] annotations,
                                            List<Class<? extends Annotation>> alreadyProcessed)
Tries to find an annotation of a given type within a list of annotations. The search is recursive - Annotations that have annotations are also checked.

Type Parameters:
A - Type of the annotation to find.
Parameters:
type - Class of annotation to find.
annotations - Array of annotations to search.
alreadyProcessed - List of already processed annotations to avoid endless looping.
Returns:
Annotation found or null.

create

@Ensures(value="\result != null")
public static RenderFieldInfo create(Field field,
                                                  Locale locale)
Creates the render information for a given field.

Parameters:
field - Field to inspect.
locale - Locale to use.
Returns:
Information or null.


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