List of usage examples for org.apache.commons.lang.builder ToStringBuilder reflectionToString
public static String reflectionToString(Object object)
Forwards to ReflectionToStringBuilder
.
From source file:de.javakaffee.web.msm.serializer.jackson.JacksonTranscoderTest.java
@Test public void testReadValueIntoObject() throws Exception { final MemcachedBackupSessionManager manager = new MemcachedBackupSessionManager(); manager.setContainer(new StandardContext()); final JacksonTranscoder transcoder = new JacksonTranscoder(manager); final StandardSession session = manager.createEmptySession(); session.setValid(true);/*w w w .j a v a 2 s .c o m*/ session.setId("foo"); session.setAttribute("person1", createPerson("foo bar", Gender.MALE, "foo.bar@example.org", "foo.bar@example.com")); session.setAttribute("person2", createPerson("bar baz", Gender.FEMALE, "bar.baz@example.org", "bar.baz@example.com")); final byte[] json = transcoder.serialize(session); System.out.println("Have json: " + new String(json)); final StandardSession readJSONValue = (StandardSession) transcoder.deserialize(json); assertEquals(readJSONValue, session); final StandardSession readJavaValue = javaRoundtrip(session, manager); assertEquals(readJavaValue, session); assertEquals(readJSONValue, readJavaValue); System.out.println(ToStringBuilder.reflectionToString(session)); System.out.println(ToStringBuilder.reflectionToString(readJSONValue)); System.out.println(ToStringBuilder.reflectionToString(readJavaValue)); }
From source file:com.ables.pix.model.Album.java
public String toString() { return ToStringBuilder.reflectionToString(this); }
From source file:com.intuit.tank.project.BaseEntity.java
/** * @{inheritDoc */ public String reflectionToString() { return ToStringBuilder.reflectionToString(this); }
From source file:com.qualogy.qafe.business.resource.rdb.RDBDatasource.java
public String toLogString() { return ToStringBuilder.reflectionToString(dataSource); }
From source file:com.github.paralleltasks.RunParallelTasksTask.java
/** * Wait for parallel tasks to complete before executing other tasks * * @param taskThreads The tasks executing in parallel *///from w w w . j av a2 s .c o m protected void waitForCompletionOf(List<Thread> taskThreads) throws InterruptedException { for (Thread taskThread : taskThreads) { try { taskThread.join(); } catch (InterruptedException ie) { getProject().getLogger().error(MarkerFactory.getMarker(ParallelTasksPlugin.PLUGIN_NAME), "Error waiting for completion of thread: {}", ToStringBuilder.reflectionToString(taskThread)); throw ie; } } }
From source file:fr.xebia.demo.ws.employee.EmployeeServiceIntegrationTest.java
@Test public void testPutEmployee() throws Exception { int id = random.nextInt(); Employee employee = new Employee(); employee.setId(null);// w w w . ja v a 2s . c om employee.setLastName("Doe-" + id); employee.setFirstName("John"); employee.setGender(Gender.MALE); employee.setBirthdate(new Date(new GregorianCalendar(1976, 01, 05).getTimeInMillis())); employeeService.putEmployee(new Holder<Employee>(employee)); System.out.println(ToStringBuilder.reflectionToString(employee)); }
From source file:cn.loveapple.client.android.shiba.view.LoveappleWebViewClient.java
/** * HTTP????URL?/*from w ww.ja v a 2s.c om*/ * * @param view * @param url * @return */ private String setLoadUrl4Proxy(String url) { // ?? String proxyUrl = activity.getProxyUrl(); if (isNotEmpty(proxyUrl)) { String[] urlStr = proxyUrl.split(":", 2); Log.d(LOG_TAG, "Proxy Host: " + ToStringBuilder.reflectionToString(urlStr)); if (isNumeric(urlStr[1])) { LoveappleHelper.setProxy(activity, urlStr[0], Integer.parseInt(urlStr[1])); } } // HTTPURL? String baseUrl = activity.getHttpProxyUrl(); if (StringUtils.isEmpty(baseUrl) || isWhiteSchema(url) || isWhiteHost(url)) { return url; } if (!url.startsWith(baseUrl)) { StringBuilder sb = new StringBuilder(url.length() + baseUrl.length()); sb.append(baseUrl); sb.append('/'); if (url.startsWith(SCHEMA_HTTP_STR)) { sb.append(url.substring(SCHEMA_HTTP_STR.length())); sb.insert(0, SCHEMA_HTTP_STR); } else if (url.startsWith(SCHEMA_HTTPS_STR)) { sb.append(url.substring(SCHEMA_HTTPS_STR.length())); sb.insert(0, SCHEMA_HTTPS_STR); } else { sb.append(url); sb.insert(0, SCHEMA_HTTP_STR); } url = sb.toString(); } return url; }
From source file:net.grinder.AgentUpdateHandler.java
/** * Update agent based on the current message. * * @param message message to be sent//from ww w . ja v a2 s . co m */ public void update(AgentUpdateGrinderMessage message) throws CommunicationException { if (message.getOffset() != offset) { throw new CommunicationException("Expected " + offset + " offset," + " but " + message.getOffset() + " was sent. " + ToStringBuilder.reflectionToString(message)); } try { IOUtils.write(message.getBinary(), agentOutputStream); offset = message.getNext(); } catch (IOException e) { throw new CommunicationException("Error while writing binary", e); } if (message.getNext() == 0) { IOUtils.closeQuietly(agentOutputStream); decompressDownloadPackage(); // Then just exist to run the agent update process. System.exit(0); } }
From source file:com.arconsis.android.datarobot.BasePersistenceTest.java
static void assertSameFields(Object one, Object other) { Collection<String> assoFieldNames = getAllFieldNames(EntityData.getEntityData(one)); boolean fieldsAreEqual = EqualsBuilder.reflectionEquals(one, other, assoFieldNames); if (!fieldsAreEqual) { Assert.fail("Expected fields to be equal but they were :\n" + ToStringBuilder.reflectionToString(one) + "\nand :\n" + ToStringBuilder.reflectionToString(other)); }/*w w w .j a va2 s .co m*/ }
From source file:com.cubeia.game.server.service.wallet.LocalDummyWalletService.java
@Override public synchronized void deposit(Money amount, int licenseeId, long sessionId, String comment) { log.debug("deposit: amount = " + amount + ", licenseeId = " + licenseeId + ", sessionId = " + sessionId); DepositResponse response = new DepositResponse(); if (!accountMap.containsKey(sessionId)) { throw new RuntimeException( "error depositing, session not found: " + ToStringBuilder.reflectionToString(response)); }/*from ww w . ja v a 2 s .c o m*/ AccountContainer account = accountMap.get(sessionId); if (amount.getAmount().intValue() > account.getBalance().getAmount().intValue()) { throw new RuntimeException("deposit denied, insufficient funds, sessionId = " + sessionId); } AccountContainer newBalance = account.credit(amount.negate()); accountMap.put(sessionId, newBalance); log.debug("balance updated, sessionId = " + sessionId + ", balance = " + newBalance.getBalance()); response.setTxId(UUID.randomUUID()); }