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, ToStringStyle style) 

Source Link

Document

Forwards to ReflectionToStringBuilder.

Usage

From source file:org.apache.hadoop.hbase.rest.model.TestRowModel.java

@Test
public void testToString() throws Exception {
    String expectedRowKey = ToStringBuilder.reflectionToString(ROW1, ToStringStyle.SIMPLE_STYLE);

    RowModel rowModel = buildTestModel();
    System.out.println(rowModel);

    assertTrue(StringUtils.contains(rowModel.toString(), expectedRowKey));
}

From source file:org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.java

/**
 * Create the {@link org.apache.commons.pool.KeyedObjectPool}, pooling
 * the {@link PersistenceBroker} instances - override this method to
 * implement your own pool and {@link org.apache.commons.pool.KeyedPoolableObjectFactory}.
 */// w  w  w . ja  v  a2s  .  co m
private GenericKeyedObjectPool createPool() {
    GenericKeyedObjectPool.Config conf = poolConfig.getKeyedObjectPoolConfig();
    if (log.isDebugEnabled())
        log.debug("PersistenceBroker pool will be setup with the following configuration "
                + ToStringBuilder.reflectionToString(conf, ToStringStyle.MULTI_LINE_STYLE));
    GenericKeyedObjectPool pool = new GenericKeyedObjectPool(null, conf);
    pool.setFactory(new PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory(this, pool));
    return pool;
}

From source file:org.codehaus.mojo.solaris.DefaultPrototypeGenerator.java

public Iterator generatePrototype(File packageRoot, List prototype, Defaults directoryDefaults,
        Defaults fileDefaults) throws MojoFailureException, MojoExecutionException {
    prototype = getEntries(prototype);//w ww  .  ja  v  a 2s.c om

    getLogger().debug("Generating prototype...");

    // -----------------------------------------------------------------------
    // Validate
    // -----------------------------------------------------------------------

    for (Iterator it = prototype.iterator(); it.hasNext();) {
        Object entry = it.next();

        Defaults defaults;

        if (entry instanceof DirectoryEntry || entry instanceof DirectoryCollection) {
            defaults = directoryDefaults;
        } else {
            defaults = fileDefaults;
        }

        ((AbstractPrototypeEntry) entry).validate(defaults);
    }

    AbstractEntryCollection defaultDirectoryCollection = new DirectoryCollection(
            directoryDefaults.getPkgClass(), directoryDefaults.getMode(), directoryDefaults.getUser(),
            directoryDefaults.getGroup(), directoryDefaults.isRelative(), directoryDefaults.getIncludes(),
            directoryDefaults.getExcludes());

    AbstractEntryCollection defaultFileCollection = new FileCollection(fileDefaults.getPkgClass(),
            fileDefaults.getMode(), fileDefaults.getUser(), fileDefaults.getGroup(), fileDefaults.isRelative(),
            fileDefaults.getIncludes(), fileDefaults.getExcludes());

    prototype.add(0, defaultDirectoryCollection);
    prototype.add(1, defaultFileCollection);

    // -----------------------------------------------------------------------
    //
    // -----------------------------------------------------------------------

    PrototypeEntryList collectedPrototypeEntries = new PrototypeEntryList();

    // -----------------------------------------------------------------------
    // Iterate through the prototype
    // -----------------------------------------------------------------------

    for (Iterator it = prototype.iterator(); it.hasNext();) {
        Object o = it.next();

        if (o instanceof SinglePrototypeEntry) {
            SinglePrototypeEntry entry = (SinglePrototypeEntry) o;

            getLogger().debug("Adding entry: ");
            getLogger().debug(" " + entry);

            if (entry instanceof DirectoryEntry) {
                entry.validate(directoryDefaults);
            } else {
                entry.validate(fileDefaults);
            }

            //                entry.adjustPath( null );

            collectedPrototypeEntries.add(entry);

            continue;
        }

        AbstractEntryCollection collection = (AbstractEntryCollection) o;
        getLogger().debug("Expanding collection: " + collection);
        getLogger().debug(" Basedir: " + packageRoot);

        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setBasedir(packageRoot);
        scanner.setIncludes(collection.getIncludes());
        scanner.setExcludes(collection.getExcludes());
        scanner.scan();

        PrototypeEntryList entries = expandCollection(collection, scanner);

        if (getLogger().isDebugEnabled()) {
            getLogger().debug(" Found " + entries.size() + " entries: ");
            for (Iterator it2 = entries.iterator(); it2.hasNext();) {
                SinglePrototypeEntry entry = (SinglePrototypeEntry) it2.next();

                getLogger().debug(
                        "  " + ToStringBuilder.reflectionToString(entry, ToStringStyle.SHORT_PREFIX_STYLE));
            }
        }

        collectedPrototypeEntries.addAll(entries);
    }

    return collectedPrototypeEntries.iterator();
}

From source file:org.codemucker.testserver.capturing.ACapturedCookie.java

@Override
public void describeTo(final Description desc) {
    desc.value("expect", ToStringBuilder.reflectionToString(expect, ToStringStyle.SHORT_PREFIX_STYLE));
}

From source file:org.codemucker.testserver.capturing.ACapturedRequest.java

@Override
public void describeTo(final Description desc) {
    super.describeTo(desc);
    desc.text(ToStringBuilder.reflectionToString(expect, ToStringStyle.MULTI_LINE_STYLE));
    desc.value("cookies", cookieMatchers);
    desc.value("headers", headerMatchers);
    desc.value("multiPartContent fileItems", fileItemMatchers);
}

From source file:org.cubictest.model.PropertyAwareObject.java

public boolean isEqualTo(Object other) {
    if (toStringStyle == null) {
        toStringStyle = new StandardToStringStyle();
    }// w  ww . ja  va  2  s  .c  o m
    toStringStyle.setUseIdentityHashCode(false);
    return ToStringBuilder.reflectionToString(other, toStringStyle)
            .equals(ToStringBuilder.reflectionToString(this, toStringStyle));
}

From source file:org.eclipse.jubula.rc.common.driver.InterceptorOptions.java

/**
 * {@inheritDoc}
 */
public String toString() {
    return ToStringBuilder.reflectionToString(this, TOSTRING_STYLE);
}

From source file:org.eclipse.wb.internal.css.semantics.LengthValue.java

@Override
public String toString() {
    return "{" + ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE) + "}";
}

From source file:org.geoserver.gwc.layer.GeoServerTileLayerInfoImpl.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    // return GeoServerTileLayerInfoLoader.marshalJson(this);
}

From source file:org.gridobservatory.greencomputing.hadoop.GcoReportParserReducer.java

private void binaryTimeseriesType(AcquisitionToolAliveBinaryTimeseriesType obj) {
    log.debug("Binary timeseries type "
            + ToStringBuilder.reflectionToString(obj, ToStringStyle.SHORT_PREFIX_STYLE));
}