Example usage for org.apache.commons.lang.builder ToStringStyle SIMPLE_STYLE

List of usage examples for org.apache.commons.lang.builder ToStringStyle SIMPLE_STYLE

Introduction

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

Prototype

ToStringStyle SIMPLE_STYLE

To view the source code for org.apache.commons.lang.builder ToStringStyle SIMPLE_STYLE.

Click Source Link

Document

The simple toString style.

Usage

From source file:org.springmodules.xt.model.generator.factory.FactoryGeneratorInterceptor.java

private Object make() {
    logger.debug("Making object of class: " + this.productClass);

    int argsNr = this.constructorArgs.size();
    Object[] argsArray = new Object[argsNr];
    Class[] typesArray = new Class[argsNr];
    for (Map.Entry<Integer, ConstructorArgPair> entry : this.constructorArgs.entrySet()) {
        int position = entry.getKey();
        Object value = entry.getValue().getValue();
        Class type = entry.getValue().getType();
        if (position < 0 || position > argsNr - 1) {
            throw new IllegalArgumentPositionException("Illegal position: " + position);
        } else {/*from   w ww . jav a  2  s . c om*/
            argsArray[position] = value;
            typesArray[position] = type;
        }
    }

    try {
        Constructor constructor = this.productClass.getConstructor(typesArray);
        Object product = constructor.newInstance(argsArray);
        return product;
    } catch (NoSuchMethodException ex) {
        throw new ObjectConstructionException("No constructor found accepting the following array of types: "
                + ToStringBuilder.reflectionToString(typesArray, ToStringStyle.SIMPLE_STYLE)
                + " Have you correctly set all constructor arguments?", ex);
    } catch (InvocationTargetException ex) {
        throw new ObjectConstructionException(
                "Exception thrown by the underlying constructor: " + ex.getMessage(), ex);
    } catch (IllegalAccessException ex) {
        throw new ObjectConstructionException("Cannot access a constructor with the following array of types: "
                + ToStringBuilder.reflectionToString(typesArray, ToStringStyle.SIMPLE_STYLE)
                + " Have you correctly set all constructor arguments?", ex);
    } catch (InstantiationException ex) {
        throw new ObjectConstructionException("Unable to instantiate the following class: " + this.productClass,
                ex);
    }
}

From source file:ph.fingra.hadoop.common.BaseObject.java

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

From source file:reconf.client.setup.GlobalPollingFrequencySettings.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).append("interval", getInterval())
            .append("time-unit", getTimeUnit()).toString();
}