org.pm4j.core.pm.impl.options
Class OptionSetDefBase<T_ATTR extends PmAttrBase<?,?>>

java.lang.Object
  extended by org.pm4j.core.pm.impl.options.OptionSetDefBase<T_ATTR>
All Implemented Interfaces:
PmOptionSetDef<T_ATTR>
Direct Known Subclasses:
EnumOptionSetDefWithOptionCfg, GenericOptionSetDef

public abstract class OptionSetDefBase<T_ATTR extends PmAttrBase<?,?>>
extends java.lang.Object
implements PmOptionSetDef<T_ATTR>

An algorithms that provides options for attribute values based on the annotation PmOptionCfg.

Author:
olaf boede

Field Summary
protected  java.lang.reflect.Method getOptionValuesMethod
           
protected  PathResolver idPath
           
protected  PmOptionCfg.NullOption nullOption
           
protected  java.lang.String nullOptionTitleResKey
           
protected  PathResolver optionsPath
           
protected  PathComparatorFactory sortComparatorFactory
           
protected  PathResolver titlePath
           
 
Constructor Summary
OptionSetDefBase(PmOptionCfg cfg, java.lang.reflect.Method getOptionValuesMethod)
           
 
Method Summary
 java.lang.String getNullOptionTitle(T_ATTR forAttr)
           
protected  java.lang.Iterable<?> getOptionValues(T_ATTR forAttr)
          Is only called if no optionsPath is specified.
protected abstract  PmOption makeOption(T_ATTR forAttr, java.lang.Object o)
           
 PmOptionSet makeOptions(T_ATTR forAttr)
          Generates the options for the attribute.
protected  boolean shouldMakeNullOption(PmAttrBase<?,?> forAttr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

optionsPath

protected final PathResolver optionsPath

getOptionValuesMethod

protected final java.lang.reflect.Method getOptionValuesMethod

idPath

protected final PathResolver idPath

titlePath

protected final PathResolver titlePath

nullOption

protected final PmOptionCfg.NullOption nullOption

nullOptionTitleResKey

protected final java.lang.String nullOptionTitleResKey

sortComparatorFactory

protected final PathComparatorFactory sortComparatorFactory
Constructor Detail

OptionSetDefBase

public OptionSetDefBase(PmOptionCfg cfg,
                        java.lang.reflect.Method getOptionValuesMethod)
Method Detail

makeOptions

public PmOptionSet makeOptions(T_ATTR forAttr)
Description copied from interface: PmOptionSetDef
Generates the options for the attribute.

Specified by:
makeOptions in interface PmOptionSetDef<T_ATTR extends PmAttrBase<?,?>>
Parameters:
forAttr - The attribute to generate the options for.
Returns:
The options or null when the attribute does not support options at all.

getNullOptionTitle

public java.lang.String getNullOptionTitle(T_ATTR forAttr)
Specified by:
getNullOptionTitle in interface PmOptionSetDef<T_ATTR extends PmAttrBase<?,?>>
Parameters:
forAttr - The attribute to generate the null-option title for.
Returns:
The title to display for the option that represents the null selection.

getOptionValues

protected java.lang.Iterable<?> getOptionValues(T_ATTR forAttr)
Is only called if no optionsPath is specified.


makeOption

protected abstract PmOption makeOption(T_ATTR forAttr,
                                       java.lang.Object o)

shouldMakeNullOption

protected boolean shouldMakeNullOption(PmAttrBase<?,?> forAttr)