Search in sources :

Example 1 with ListWithReferencesBean

use of org.onebusaway.api.model.transit.ListWithReferencesBean in project onebusaway-application-modules by camsys.

the class CustomCsvHandler method getEntityType.

/**
 **
 *
 ***
 */
private Class<?> getEntityType(Object obj) {
    if (obj instanceof ResponseBean) {
        ResponseBean response = (ResponseBean) obj;
        if (response.getData() == null)
            return response.getClass();
        return getEntityType(response.getData());
    } else if (obj instanceof EntryWithReferencesBean) {
        EntryWithReferencesBean<?> entry = (EntryWithReferencesBean<?>) obj;
        return entry.getEntry().getClass();
    } else if (obj instanceof ListWithReferencesBean) {
        ListWithReferencesBean<?> list = (ListWithReferencesBean<?>) obj;
        List<?> values = list.getList();
        if (values.isEmpty())
            return Object.class;
        return values.get(0).getClass();
    }
    return obj.getClass();
}
Also used : ListWithReferencesBean(org.onebusaway.api.model.transit.ListWithReferencesBean) EntryWithReferencesBean(org.onebusaway.api.model.transit.EntryWithReferencesBean) ResponseBean(org.onebusaway.api.model.ResponseBean)

Aggregations

ResponseBean (org.onebusaway.api.model.ResponseBean)1 EntryWithReferencesBean (org.onebusaway.api.model.transit.EntryWithReferencesBean)1 ListWithReferencesBean (org.onebusaway.api.model.transit.ListWithReferencesBean)1