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
ConstructorsConstructorDescriptionMethodDataSource(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 TypeMethodDescriptionbooleanGets 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.FastMethodGets the FastMethod that this MethodDataSource will invoke on a "get".Class<?>Gets the type of the object that this DataSource can retreive data from.inthashCode()
-
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:DataSourceGets the type of data produced by this DataSource.- Specified by:
getDataTypein interfaceDataSource- Returns:
- the type of data produced by this DataSource.
-
getId
Description copied from interface:DataSourceGets the unique id of this DataSource. The id should be unique across the DataSet that this source is added to.- Specified by:
getIdin interfaceDataSource- Returns:
- the unique id of this DataSource.
-
get
Description copied from interface:NonAggregateDataSourceGets data given the specified object.- Specified by:
getin interfaceNonAggregateDataSource- Parameters:
obj- an object to get the data from- Returns:
- the retrieved data.
-
getSourceType
Description copied from interface:DataSourceGets the type of the object that this DataSource can retreive data from.- Specified by:
getSourceTypein interfaceDataSource- Returns:
- the type of the object that this DataSource can retreive data from.
-
hashCode
public int hashCode() -
equals
-