Example usage for org.apache.commons.lang.builder ToStringBuilder reflectionToString

List of usage examples for org.apache.commons.lang.builder ToStringBuilder reflectionToString

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder ToStringBuilder reflectionToString.

Prototype

public static String reflectionToString(Object object) 

Source Link

Document

Forwards to ReflectionToStringBuilder.

Usage

From source file:fr.dudie.keolis.client.JsonKeolisClientTest.java

/**
 * Test method for {@link JsonKeolisClient#getAllSubwayStations()}.
 * /*from   w  w  w . j  a  va 2 s  .c o  m*/
 * @throws IOException
 *             an error occurred
 */
@Test
public void testGetAllSubwayStations() throws IOException {

    LOGGER.info("testGetAllSubwayStations.start");

    final List<SubwayStation> stations = getKeolisClient().getAllSubwayStations();

    assertNotNull("no subway station returned by the api", stations);
    assertTrue("at least one station should be returned by the api", stations.size() > 0);
    assertEquals("on November, 25th 2011, the keolis API returns 15 subway stations", 15, stations.size());

    for (final SubwayStation station : stations) {
        LOGGER.debug("{}", ToStringBuilder.reflectionToString(station));
    }

    LOGGER.info("testGetAllSubwayStations.end");
}

From source file:easycare.load.util.db.loader.OrganisationDataLoader.java

public void createAndAddLocationToOrganisation(ContextOfCurrentLoad context, int currentLocationNumber,
        Organisation organisation) {//from  w ww  . j  a v  a2s. com
    int humanReadableLocationNumber = currentLocationNumber + 1;
    String locationName = String.format("%s-L%04d", organisation.getName(), humanReadableLocationNumber);
    Location location = createAndAddLocationToOrganisation(context.getFaker(), locationName, organisation);

    if (log.isTraceEnabled()) {
        String locationStr = ToStringBuilder.reflectionToString(location);
        log.trace(String.format("Index: [%d], Location: [%s]", currentLocationNumber, locationStr));
    }
}

From source file:fr.dudie.keolis.client.JsonKeolisClientTest.java

/**
 * Test method for {@link JsonKeolisClient#getAllSubwayStations()}.
 * /* w  ww.jav a  2s .com*/
 * @throws IOException
 *             an error occurred
 */
@Test
public void testGetAllSubwayStationsNearFrom() throws IOException {

    LOGGER.info("testGetAllSubwayStationsNearFrom.start");

    // search near Rennes, France
    final List<SubwayStation> stations = getKeolisClient().getSubwayStationsNearFrom(48109600, -1679200);

    assertNotNull("no subway station returned by the api", stations);
    assertEquals("3 stations should be returned by the api", 3, stations.size());

    for (final SubwayStation station : stations) {
        LOGGER.debug("{}", ToStringBuilder.reflectionToString(station));
    }

    LOGGER.info("testGetAllSubwayStationsNearFrom.end");
}

From source file:com.albert.javatest.JavaTestExample.java

private static <S, T extends Iterable<S>> void print(T list) {
    if (list == null) {
        System.out.println("Passed in list is null or empty!");
    }/*from  w  ww . j a v  a  2  s.co  m*/
    System.out.println(
            "------------------------------------ print collectioin start ------------------------------------");
    for (Object element : list) {
        System.out.println(ToStringBuilder.reflectionToString(element));
    }
    System.out.println(
            "------------------------------------ print collectioin end ------------------------------------");
}

From source file:fr.dudie.keolis.client.JsonKeolisClientTest.java

/**
 * Test method for {@link JsonKeolisClient#getSubwayStation(String)}.
 * /*from   ww  w.ja  v  a 2 s  .c o  m*/
 * @throws IOException
 *             an error occurred
 */
@Test
public void testGetSubwayStations() throws IOException {

    LOGGER.info("testGetSubwayStations.start");

    final SubwayStation station = getKeolisClient().getSubwayStation("VU");

    LOGGER.debug("{}", ToStringBuilder.reflectionToString(station));

    assertNotNull("no subway station returned by the api", station);
    assertEquals("Villejean-Universit", station.getName());
    assertEquals(48.12125, station.getLatitude(), 0);
    assertEquals(-1.70395, station.getLongitude(), 0);
    assertEquals(14, station.getRankingPlatformDirection1());
    assertEquals(16, station.getRankingPlatformDirection2());
    assertEquals(-1, station.getFloors());
    assertNotNull(String.format("station [%s] has no last update date", station), station.getLastUpdate());

    LOGGER.info("testGetSubwayStations.end");
}

From source file:com.lmco.ddf.endpoints.rest.TestRestEndpoint.java

@Test()
public void testAddDocumentPositiveCase() throws IOException, CatalogTransformerException, IngestException,
        SourceUnavailableException, URISyntaxException {

    CatalogFramework framework = givenCatalogFramework(SAMPLE_ID);

    HttpHeaders headers = createHeaders(Arrays.asList(MediaType.APPLICATION_JSON));

    RESTEndpoint rest = new RESTEndpoint(framework);

    addMatchingService(rest, Arrays.asList(getSimpleTransformer()));

    UriInfo info = givenUriInfo(SAMPLE_ID);

    Response response = rest.addDocument(headers, info, new ByteArrayInputStream("".getBytes()));

    LOGGER.debug(ToStringBuilder.reflectionToString(response));

    assertThat(response.getStatus(), equalTo(201));

    assertThat(response.getMetadata(), notNullValue());

    assertThat(response.getMetadata().get(Metacard.ID).get(0).toString(), equalTo(SAMPLE_ID));
}

From source file:caarray.client.examples.grid.DownloadDataColumnsFromFile.java

private void printColumnValues(QuantitationType quantitationType, AbstractDataColumn dataColumn) {
    // Extract individual values in the column according to its type.
    DataType columnDataType = quantitationType.getDataType();
    switch (columnDataType) {
    case BOOLEAN:
        boolean[] booleanValues = ((BooleanColumn) dataColumn).getValues();
        System.out.println("Retrieved " + booleanValues.length + " boolean values.");
        break;/*  w w  w  .j  av a  2  s  .co m*/
    case INTEGER:
        int[] intValues = ((IntegerColumn) dataColumn).getValues();
        System.out.println("Retrieved " + intValues.length + " int values.");
        break;
    case DOUBLE:
        double[] doubleValues = ((DoubleColumn) dataColumn).getValues();
        System.out.println("Retrieved " + doubleValues.length + " double values.");
        break;
    case FLOAT:
        float[] floatValues = ((FloatColumn) dataColumn).getValues();
        System.out.println("Retrieved " + floatValues.length + " float values.");
        System.out.println("Float values: " + ToStringBuilder.reflectionToString(floatValues));
        break;
    case SHORT:
        short[] shortValues = ((ShortColumn) dataColumn).getValues();
        System.out.println("Retrieved " + shortValues.length + " short values.");
        break;
    case LONG:
        long[] longValues = ((LongColumn) dataColumn).getValues();
        System.out.println("Retrieved " + longValues.length + " long values.");
        break;
    case STRING:
        String[] stringValues = ((StringColumn) dataColumn).getValues();
        System.out.println("Retrieved " + stringValues.length + " String values.");
        break;
    default:
        // Should never get here.
    }
}

From source file:com.prowidesoftware.swift.model.mx.XmlEventWriter.java

public void add(XMLEventReader arg0) throws XMLStreamException {
    log.fine("ADD EventReader: " + ToStringBuilder.reflectionToString(arg0));
}

From source file:fr.dudie.keolis.client.JsonKeolisClientTest.java

/**
 * Test method for {@link JsonKeolisClient#getAllLinesAlerts()}.
 * //from ww w. j  a  va  2 s  .c  om
 * @throws IOException
 *             an error occurred
 */
@Test
public void testGetAllLineAlerts() throws IOException {

    LOGGER.info("testGetAllLineAlerts.start");

    List<LineAlert> alerts = null;

    alerts = getKeolisClient().getAllLinesAlerts();

    assertNotNull("no alert returned by the api", alerts);
    assertTrue("at least one alert should be returned by the api", alerts.size() > 0);

    for (final LineAlert alert : alerts) {
        LOGGER.debug("{}", ToStringBuilder.reflectionToString(alert));
    }

    LOGGER.info("testGetAllLineAlerts.end");
}

From source file:com.all.mobile.web.services.WidgetService.java

@SuppressWarnings("unchecked")
public Serializable save(String model) throws Exception {
    log.info("Converting model... \"" + model + "\"");
    ArrayList<MobileTrack> playlist = JsonConverter.toTypedCollection(model, ArrayList.class,
            MobileTrack.class);
    log.info(playlist.size() + " tracks converted.");
    for (MobileTrack mobileTrack : playlist) {
        log.info(ToStringBuilder.reflectionToString(mobileTrack));
    }/* w w  w . java2s . c om*/
    WidgetContent content = new WidgetContent(playlist);
    return dao.save(content);
}