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:com.gemini.domain.model.GeminiNetwork.java

public boolean deleteServer(GeminiServer s) {
    if (servers.contains(s)) {
        if (!servers.remove(s)) {
            Logger.error("Failed to delete server: {}",
                    ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE));
            return false;
        } else {/*from w  w  w  .j av  a2s  . c o  m*/
            //remove the connection between this network and the server
            //s.setNetwork(null);
            Logger.debug("Successfully deleted server: {}",
                    ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE));
            return true;
        }
    } else {
        Logger.info("Did not delete server, server does not exist in networkserver: {} network: {}",
                ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE),
                ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE));
        return false;
    }
}

From source file:jp.co.ctc_g.jse.amqp.showcase.business.domain.UserProfile.java

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

From source file:com.change_vision.astah.extension.plugin.cplusreverse.reverser.DoxygenXmlParser.java

public static String parser(String path)
        throws LicenseNotFoundException, ProjectLockedException, IndexXmlNotFoundException, Throwable {
    long totalTime = System.currentTimeMillis();
    ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

    File indexFile;//from   ww w.  j  ava  2s . c  om
    if ((indexFile = findFile(path, "index.xml")) == null) {
        throw new IndexXmlNotFoundException();
    }

    // check template project
    String astahModelPath = getTempAstahModelPath();
    InputStream stream = DoxygenXmlParser.class.getResourceAsStream("C++.asta");
    prjAccessor.open(stream);
    logger.info("Importing... please wait..");

    // get current jude project's root
    IModel project = ProjectAccessorFactory.getProjectAccessor().getProject();

    DoxygenXmlParser doxygenXmlParser = new DoxygenXmlParser();

    // begin transaction
    TransactionManager.beginTransaction();

    // get the availability the concourse
    long thestart = System.currentTimeMillis();
    CompoundDef[] compounddefes = null;
    {
        List<CompoundDef> theComs = doxygenXmlParser.parserIndexXml(indexFile);
        compounddefes = theComs.toArray(new CompoundDef[theComs.size()]);
    }
    logger.trace(String.format("xml parse:%d", System.currentTimeMillis() - thestart));

    logger.trace(String.format("first deal namespace"));
    int length = compounddefes.length;
    for (int i = 0; i < length; ++i) {
        long start = System.currentTimeMillis();
        // first deal namespace
        CompoundDef compounddef = compounddefes[i];
        try {
            if (CompoundDef.KIND_NAMESPACE.equals(compounddef.getCompounddefKind())
                    || CompoundDef.KIND_INTERFACE.equals(compounddef.getCompounddefKind())) {
                // #205 #219
                // (compounddef).convertToJudeModel(project,
                // indexFile.getParentFile().listFiles());
                lastCompoundDef = compounddef;
                compounddef.convertToJudeModel(project, indexFile.getParentFile().listFiles());
                //
            }
        } catch (Exception e) {
            logger.error(ToStringBuilder.reflectionToString(compounddef, ToStringStyle.MULTI_LINE_STYLE));
            throw e;
        }
        logger.trace(String.format("%d", System.currentTimeMillis() - start));
    }
    logger.trace(String.format("second deal all the compound"));
    for (int i = 0; i < length; ++i) {
        // second deal all the compound
        long start = System.currentTimeMillis();
        CompoundDef compounddef = compounddefes[i];
        lastCompoundDef = compounddef;
        try {
            compounddef.convertToJudeModel(project, indexFile.getParentFile().listFiles());
        } catch (Exception e) {
            logger.error(ToStringBuilder.reflectionToString(compounddef, ToStringStyle.MULTI_LINE_STYLE));
            throw e;
        }
        logger.trace(String.format("%d", System.currentTimeMillis() - start));
        //
    }
    logger.trace(String.format("third convert all children"));
    for (int i = 0; i < length; ++i) {
        // third convert all children
        long start = System.currentTimeMillis();
        CompoundDef compounddef = compounddefes[i];
        lastCompoundDef = compounddef;
        try {
            compounddef.convertChildren(indexFile.getParentFile().listFiles());
        } catch (Exception e) {
            logger.error(ToStringBuilder.reflectionToString(compounddef, ToStringStyle.MULTI_LINE_STYLE));
            throw e;
        }
        logger.trace(String.format("%d", System.currentTimeMillis() - start));
        //
    }

    CompoundDef.compounddef.clear();

    // end transaction
    TransactionManager.endTransaction();

    // save the project
    prjAccessor.saveAs(astahModelPath);
    prjAccessor.close();

    logger.info("Import Done.");
    logger.debug(String.format("%d", System.currentTimeMillis() - totalTime));

    return astahModelPath;
}

From source file:net.objectlab.kit.util.Pair.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, new StandardToStringStyle());
}

From source file:com.gemini.provision.security.openstack.SecurityProviderOpenStackImpl.java

/**
 *
 * @param tenant/*from   ww w  .ja  v a 2  s  . c o  m*/
 * @param env
 * @return
 *
 * List all the security groups.
 */
@Override
public List<GeminiSecurityGroup> listAllSecurityGroups(GeminiTenant tenant, GeminiEnvironment env) {
    List<GeminiSecurityGroup> listSecGrps = Collections.synchronizedList(new ArrayList());

    //authenticate the session with the OpenStack installation
    OSClient os = OSFactory.builder().endpoint(env.getEndPoint())
            .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName())
            .authenticate();
    if (os == null) {
        Logger.error("Failed to authenticate Tenant: {}",
                ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE));
        return null;
    }

    //get the list from OpenStack
    List<? extends SecurityGroup> osSecGrps = os.networking().securitygroup().list();
    osSecGrps.stream().forEach(osSecGrp -> {
        //see if this security group already exists in the environment
        GeminiSecurityGroup tmpSecGrp = null;
        GeminiSecurityGroup newGemSecGrp = null;
        try {
            tmpSecGrp = env.getSecurityGroups().stream().filter(s -> s.getName().equals(osSecGrp.getName()))
                    .findFirst().get();
            tmpSecGrp.setProvisioned(true);
            tmpSecGrp.setCloudID(osSecGrp.getId());
        } catch (NoSuchElementException | NullPointerException ex) {
            //The OpenStack security group hasn't been mapped to an object on the Gemini side, so create it and add to the environment
            newGemSecGrp = new GeminiSecurityGroup();
            newGemSecGrp.setCloudID(osSecGrp.getId());
            newGemSecGrp.setProvisioned(true);
            newGemSecGrp.setName(osSecGrp.getName());
            newGemSecGrp.setDescription(osSecGrp.getDescription());
            env.addSecurityGroup(newGemSecGrp);
        }

        //check to see if this group's rules are mapped on the Gemini side
        List<? extends SecurityGroupRule> osSecGrpRules = osSecGrp.getRules();
        final GeminiSecurityGroup gemSecGrp = tmpSecGrp == null ? newGemSecGrp : tmpSecGrp;
        osSecGrpRules.stream().filter(osSecGrpRule -> osSecGrpRule != null).forEach(osSecGrpRule -> {
            GeminiSecurityGroupRule gemSecGrpRule = null;
            try {
                gemSecGrpRule = gemSecGrp.getSecurityRules().stream()
                        .filter(sr -> sr.getCloudID().equals(osSecGrpRule.getId())).findFirst().get();
            } catch (NoSuchElementException | NullPointerException ex) {
                //not an error or even log worthy ... just signifies that the rule
                //on Gemini Side needs to be created
            }
            if (gemSecGrpRule == null) {
                //the rule has not been mapped on the Gemini side, so create it
                gemSecGrpRule = new GeminiSecurityGroupRule();
            }
            gemSecGrpRule.setCloudID(osSecGrpRule.getId());
            gemSecGrpRule.setProvisioned(true);
            gemSecGrpRule.setPortRangeMin(osSecGrpRule.getPortRangeMin());
            gemSecGrpRule.setPortRangeMax(osSecGrpRule.getPortRangeMax());
            gemSecGrpRule.setProtocol(Protocol.fromString(osSecGrpRule.getProtocol()));
            gemSecGrpRule.setDirection(
                    GeminiSecurityGroupRuleDirection.valueOf(osSecGrpRule.getDirection().toUpperCase()));
            gemSecGrpRule.setRemoteGroupId(osSecGrpRule.getRemoteGroupId());
            gemSecGrpRule.setRemoteIpPrefix(osSecGrpRule.getRemoteIpPrefix());
            gemSecGrpRule.setIpAddressType(IPAddressType.valueOf(osSecGrpRule.getEtherType()));
            //gemSecGrpRule.setCidr(osSecGrpRule.getRange().getCidr());
            gemSecGrpRule.setParent(gemSecGrp);
            gemSecGrp.addSecurityRule(gemSecGrpRule);
        });
        listSecGrps.add(gemSecGrp);
    });

    Logger.debug("Successfully retrieved all security groups Tenant: {} Env: {}", tenant.getName(),
            env.getName());
    return listSecGrps;
}

From source file:com.redhat.rhn.frontend.nav.NavNode.java

/**
 *  String version of node//from   w w  w  . ja v  a  2  s . c om
 *  @return String the stringified node
 */
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

From source file:fr.dudie.nominatim.client.JsonNominatimClientTest.java

@Test
public void testGetAddress() throws IOException {

    LOGGER.info("testGetAddress.start");

    final Address address = nominatimClient.getAddress(1.64891269513038, 48.1166561643464);
    LOGGER.debug(ToStringBuilder.reflectionToString(address, ToStringStyle.MULTI_LINE_STYLE));

    assertNotNull("a result should be found", address);
    assertTrue("address expose the OSM place_id", address.getPlaceId() > 0);
    assertNull("no polygonpoint", address.getPolygonPoints());

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

From source file:jp.co.ctc_g.jse.csv.showcase.business.domain.UserProfile.java

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

From source file:edu.harvard.iq.dataverse.ingest.tabulardata.InvalidData.java

/**
 * Returns a string representation of this instance.
 * //from ww  w.  j av a 2  s .  com
 * @return a string representing this instance.
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

From source file:com.marvelution.jira.plugins.hudson.rest.model.Server.java

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