All Downloads are FREE. Search and download functionalities are using the official Maven repository.

enterprises.orbital.impl.evexmlapi.act.APIKeyInfoParser Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package enterprises.orbital.impl.evexmlapi.act;

import java.io.IOException;

import org.apache.commons.digester.Digester;

import enterprises.orbital.evexmlapi.act.IAPIKeyInfo;
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 class APIKeyInfoParser extends AbstractApiParser {
  public APIKeyInfoParser(ApiConnector connector) {
    super(connector, APIKeyInfoResponse.class, ApiEndpoint.ACT_API_KEY_INFO_V1);
  }

  @Override
  protected Digester getDigester() {
    Digester digester = super.getDigester();
    digester.addObjectCreate("eveapi/result/key", ApiAPIKeyInfo.class);
    digester.addSetProperties("eveapi/result/key");
    digester.addSetNext("eveapi/result/key", "setApiKeyInfo");
    digester.addObjectCreate("eveapi/result/key/rowset/row", ApiCharacter.class);
    digester.addSetProperties("eveapi/result/key/rowset/row");
    digester.addSetNext("eveapi/result/key/rowset/row", "addCharacter");
    return digester;
  }

  @Override
  public IAPIKeyInfo retrieveResponse(AbstractAPIRequestAdapter adapter) throws IOException {
    APIKeyInfoResponse response = getResponse(adapter.getAuth());
    adapter.setFromLastResponse(response);
    if (adapter.isError()) return null;
    return response.getAPIKeyInfo();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy