enterprises.orbital.impl.evexmlapi.shared.AbstractContractsParser Maven / Gradle / Ivy
package enterprises.orbital.impl.evexmlapi.shared;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.digester.Digester;
import enterprises.orbital.evexmlapi.shared.IContract;
import enterprises.orbital.impl.evexmlapi.AbstractAPIRequestAdapter;
import enterprises.orbital.impl.evexmlapi.AbstractApiParser;
import enterprises.orbital.impl.evexmlapi.ApiConnector;
import enterprises.orbital.impl.evexmlapi.ApiEndpoint;
public abstract class AbstractContractsParser extends AbstractApiParser> {
protected AbstractContractsParser(ApiConnector connector, ApiEndpoint endpoint) {
super(connector, ContractsResponse.class, endpoint);
}
@Override
protected Digester getDigester() {
Digester digester = super.getDigester();
digester.addObjectCreate("eveapi/result/rowset/row", ApiContract.class);
digester.addSetProperties("eveapi/result/rowset/row");
digester.addSetNext("eveapi/result/rowset/row", "addContract");
return digester;
}
@Override
public Collection retrieveResponse(AbstractAPIRequestAdapter adapter) throws IOException {
ContractsResponse response = getResponse(adapter.getAuth());
adapter.setFromLastResponse(response);
if (adapter.isError()) return null;
Collection result = new ArrayList();
result.addAll(response.getContracts());
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy