Class ReflectiveColumnPropertyAccessor<R>
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor<R>
-
- Type Parameters:
R
- type of the row object/bean
- All Implemented Interfaces:
IColumnAccessor<R>
,IColumnPropertyAccessor<R>
,IColumnPropertyResolver
- Direct Known Subclasses:
ExtendedReflectiveColumnPropertyAccessor
,HierarchicalReflectiveColumnPropertyAccessor
public class ReflectiveColumnPropertyAccessor<R> extends Object implements IColumnPropertyAccessor<R>
Convenience class which uses java reflection to get/set property names from the row bean. It looks for getter methods for reading and setter methods for writing according to the Java conventions.
-
-
Constructor Summary
Constructors Constructor Description ReflectiveColumnPropertyAccessor(String... propertyNames)
ReflectiveColumnPropertyAccessor(List<String> propertyNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getColumnCount()
int
getColumnIndex(String propertyName)
String
getColumnProperty(int columnIndex)
Object
getDataValue(R rowObj, int columnIndex)
protected PropertyDescriptor
getPropertyDescriptor(Object rowObj, String propertyName)
void
setDataValue(R rowObj, int columnIndex, Object newValue)
-
-
-
Constructor Detail
-
ReflectiveColumnPropertyAccessor
public ReflectiveColumnPropertyAccessor(String... propertyNames)
- Parameters:
propertyNames
- of the members of the row bean
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfaceIColumnAccessor<R>
-
getDataValue
public Object getDataValue(R rowObj, int columnIndex)
- Specified by:
getDataValue
in interfaceIColumnAccessor<R>
-
setDataValue
public void setDataValue(R rowObj, int columnIndex, Object newValue)
- Specified by:
setDataValue
in interfaceIColumnAccessor<R>
-
getColumnProperty
public String getColumnProperty(int columnIndex)
- Specified by:
getColumnProperty
in interfaceIColumnPropertyResolver
- Parameters:
columnIndex
- i.e the order of the column in the backing bean- Returns:
- the column property name for the provided column index.
-
getColumnIndex
public int getColumnIndex(String propertyName)
- Specified by:
getColumnIndex
in interfaceIColumnPropertyResolver
- Parameters:
propertyName
- i.e the name of the column in the backing bean- Returns:
- the column index for the provided property name.
-
getPropertyDescriptor
protected PropertyDescriptor getPropertyDescriptor(Object rowObj, String propertyName) throws IntrospectionException
- Parameters:
rowObj
- The Java Bean for which thePropertyDescriptor
is requested.propertyName
- The name of the property for which thePropertyDescriptor
is requested.- Returns:
- The
PropertyDescriptor
that describes the property with the given name in the given Java Bean object that exports it via a pair of accessor methods. - Throws:
IntrospectionException
- if an exception occurs during introspection- Since:
- 1.6
-
-