Package repast.simphony.data2
Class MethodDataSource
java.lang.Object
repast.simphony.data2.MethodDataSource
- All Implemented Interfaces:
DataSource
,NonAggregateDataSource
DataSource that retrieves data from a method call on an object.
- Author:
- Nick Collier
-
Constructor Summary
ConstructorDescriptionMethodDataSource
(String id, Class<?> clazz, String methodName) Creates a MethodDataSource that will call the named method on objects of the specified type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets data given the specified object.Class<?>
Gets the type of data produced by this DataSource.getId()
Gets the unique id of this DataSource.net.sf.cglib.reflect.FastMethod
Gets the FastMethod that this MethodDataSource will invoke on a "get".Class<?>
Gets the type of the object that this DataSource can retreive data from.int
hashCode()
-
Constructor Details
-
MethodDataSource
Creates a MethodDataSource that will call the named method on objects of the specified type. The method must not return void and must take 0 arguments.- Parameters:
id
- a unique identifier for this DataSource.clazz
- the object typemethodName
- the name of the method to call
-
-
Method Details
-
getMethod
public net.sf.cglib.reflect.FastMethod getMethod()Gets the FastMethod that this MethodDataSource will invoke on a "get".- Returns:
- the FastMethod that this MethodDataSource will invoke on a "get".
-
getDataType
Description copied from interface:DataSource
Gets the type of data produced by this DataSource.- Specified by:
getDataType
in interfaceDataSource
- Returns:
- the type of data produced by this DataSource.
-
getId
Description copied from interface:DataSource
Gets the unique id of this DataSource. The id should be unique across the DataSet that this source is added to.- Specified by:
getId
in interfaceDataSource
- Returns:
- the unique id of this DataSource.
-
get
Description copied from interface:NonAggregateDataSource
Gets data given the specified object.- Specified by:
get
in interfaceNonAggregateDataSource
- Parameters:
obj
- an object to get the data from- Returns:
- the retrieved data.
-
getSourceType
Description copied from interface:DataSource
Gets the type of the object that this DataSource can retreive data from.- Specified by:
getSourceType
in interfaceDataSource
- Returns:
- the type of the object that this DataSource can retreive data from.
-
hashCode
public int hashCode() -
equals
-