Package org.onebusaway.csv_entities

Examples of org.onebusaway.csv_entities.EntityHandler


    CsvEntityReader reader = new CsvEntityReader();
    reader.setInputLocation(_naptanCsvPath);
    AnnotationDrivenEntitySchemaFactory entitySchema = new AnnotationDrivenEntitySchemaFactory();
    entitySchema.addPackageToScan("org.onebusaway.uk.naptan.csv");
    reader.setEntitySchemaFactory(entitySchema);
    reader.addEntityHandler(new EntityHandler() {
      @Override
      public void handleEntity(Object arg0) {
        NaPTANStop stop = (NaPTANStop) arg0;
        _stopsByAtcoId.put(stop.getAtcoCode(), stop);
      }
View Full Code Here


  public void readStationLocations(File path) throws CsvEntityIOException,
      IOException {
    BufferedReader reader = new BufferedReader(new FileReader(path));
    CsvEntityReader csvEntityReader = new CsvEntityReader();
    csvEntityReader.addEntityHandler(new EntityHandler() {
      @Override
      public void handleEntity(Object bean) {
        StationLocation stationLocation = (StationLocation) bean;
        Point2D.Double xy = ProjectionSupport.convertFromLatLon(
            stationLocation.getLat(), stationLocation.getLon());
View Full Code Here

  @Override
  public String fromObject(Object obj, String resultCode, Writer stream)
      throws IOException {
    CsvEntityWriterFactory factory = new CsvEntityWriterFactory();
    Class<?> entityType = getEntityType(obj);
    EntityHandler csvHandler = factory.createWriter(entityType, stream);

    List<?> values = getEntityValues(obj);
    for (Object value : values)
      csvHandler.handleEntity(value);

    return null;
  }
View Full Code Here

TOP

Related Classes of org.onebusaway.csv_entities.EntityHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.