List of usage examples for org.apache.commons.lang ArrayUtils toString
public static String toString(Object array)
Outputs an array as a String, treating null
as an empty array.
From source file:com.ikon.util.FormatUtil.java
/** * Format string array/*from w ww.j a v a 2 s. c om*/ */ public static String formatArray(String[] values) { if (values != null) { if (values.length == 1) { return values[0]; } else { return ArrayUtils.toString(values); } } else { return "NULL"; } }
From source file:com.taobao.ad.easyschedule.action.uuser.UUserAction.java
@ActionSecurity(module = 11) public String addUser() { if (user != null && roles != null && roles.length > 0) { if (StringUtils.isNotEmpty(user.getPassword())) { user.setPassword(Md5Encrypt.md5(user.getPassword())); }//from w w w. j av a 2 s. c o m user.setStatus(Long.valueOf(Constants.STATUS_YES)); userBO.insertUUser(user, roles, groups); StringBuilder detail = new StringBuilder(); detail.append("roles:").append(ArrayUtils.toString(roles)); detail.append(";groups:").append(ArrayUtils.toString(groups)); logsBO.insertSuccess(LogsDO.SUBTYPE_USER_ADD, user.getUsername() + "|" + (user.getDescn() == null ? "" : user.getDescn()), detail.toString(), getLogname()); } return SUCCESS; }
From source file:info.magnolia.voting.voters.VoterSet.java
@Override public String toString() { return super.toString() + " set: " + (not ? "not " : "") + ArrayUtils.toString(voters); }
From source file:com.tbb.logging.LoggingBean.java
/** * Do not rely on stability of this method. Subject to change in further releases. * /*from w w w. j a va2 s .c om*/ * @return commandName and its args as one String */ @Override public String toString() { return "commandName=" + commandName + ", args=" + ArrayUtils.toString(args); }
From source file:de.codesourcery.eve.skills.util.CsvHelperTest.java
protected void assertArrayEquals(String[] actual, String... expected) { if (!ArrayUtils.isEquals(actual, expected)) { fail("Got: " + ArrayUtils.toString(actual) + " , expected: " + ArrayUtils.toString(expected)); }/* w ww . j a v a 2s.co m*/ }
From source file:com.ikon.util.FormatUtil.java
/** * Format object// ww w.ja va 2 s.c o m */ public static String formatObject(Object value) { if (value != null) { if (value instanceof Object[]) { return ArrayUtils.toString(value); } else { return value.toString(); } } else { return "NULL"; } }
From source file:com.talent.nio.communicate.receive.DecodeRunnable.java
/** * ??/*from ww w .j a v a2 s. c o m*/ * * @param datas */ public void addMsg(ByteBuf datas) { if (DebugUtils.isNeedDebug(channelContext)) { log.error("com.talent.nio.communicate.receive.DecodeRunnable.addMsg(byte[]):" + ArrayUtils.toString(datas)); try { log.error("com.talent.nio.communicate.receive.DecodeRunnable.addMsg(byte[]):" + new String(datas.array(), "utf-8")); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); } } getMsgQueue().add(datas); }
From source file:net.sf.reportengine.util.TestCoefficients.java
/** * Test method for {@link net.sf.reportengine.util.CrossTabCoefficients#Coefficients(java.lang.String[][], boolean)}. *//*from w ww . java2s . c om*/ public void testCoefficientsWithTotals1() { String[][] distinctValues = new String[][] { new String[] { "North", "South", "East", "West" }, new String[] { "M", "F" } }; classUnderTest = new CrossTabCoefficients(distinctValues, true); assertNotNull(classUnderTest); //test colcount and rowcount assertEquals(classUnderTest.getTemplateColumnCount(), 13); assertEquals(classUnderTest.getTemplateRowCount(), 2); //test number of distinct values per row int[] result = classUnderTest.getDistValuesCntInHeaderRow(); assertNotNull(result); System.out.println("Distinct Values : " + ArrayUtils.toString(result)); assertTrue(ArrayUtils.isEquals(result, new int[] { 4, 2 })); //test number of spaces result = classUnderTest.getSpacesCntInHeaderRow(); assertNotNull(result); System.out.println("Spaces Cnt (if totals were displayed): " + ArrayUtils.toString(result)); assertTrue(ArrayUtils.isEquals(result, new int[] { 0, 1 })); //test number of totals result = classUnderTest.getTotalsCntInHeaderRow(); assertNotNull(result); System.out.println("Totals Cnt : " + ArrayUtils.toString(result)); assertTrue(ArrayUtils.isEquals(result, new int[] { 1, 4 })); //test number of totals result = classUnderTest.getColspanPerRow(); assertNotNull(result); System.out.println("Distance between distinct header values : " + ArrayUtils.toString(result)); assertTrue(ArrayUtils.isEquals(result, new int[] { 3, 1 })); }
From source file:com.jaspersoft.jasperserver.repository.test.RepositoryServiceDependentResourcesTest.java
@Test public void shouldFindAllDependantReportsForDataSource() { assertNotNull("RepositoryService service is not wired.", getRepositoryService()); assertNotNull("SearchCriteriaFactory service is not wired.", searchCriteriaFactory); String uri = "/datasources/JServerJNDIDS"; List<ResourceLookup> resources = getRepositoryService().getDependentResources(null, uri, searchCriteriaFactory, 0, 20); assertEquals("Should find 9 dependant resources.", 9, resources.size()); assertEquals("All resources should be lookup's.", 9, CollectionUtils.countMatches(resources, PredicateUtils.instanceofPredicate(ResourceLookup.class))); Collection types = CollectionUtils.collect(resources, TransformerUtils.invokerTransformer("getResourceType")); assertEquals("All lookup's should have type ReportUnit.", 9, CollectionUtils.countMatches(types, PredicateUtils.equalPredicate( "com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit"))); String sortOrder = ArrayUtils.toString( CollectionUtils.collect(resources, TransformerUtils.invokerTransformer("getURIString")).toArray()); assertEquals("Resources should be sorted in order.", expectedOrder, sortOrder); }
From source file:com.canoo.webtest.extension.VerifyContent.java
protected void verifyParameters() { super.verifyParameters(); nullParamCheck(getReferenceFile(), "referenceFile"); if (!getReferenceFile().exists()) { throw new StepFailedException("Reference file doesn't exist: " + getReferenceFile().getAbsolutePath()); }/*from w w w . j a v a 2 s . c om*/ final String mode = getMode().toLowerCase(); final String[] allowedModes = { DIFF_MODE_AUTO, DIFF_MODE_BIN, DIFF_MODE_TEXT, DIFF_MODE_REGEXPERLINE }; if (!ArrayUtils.contains(allowedModes, mode)) { throw new StepExecutionException("Unallowed diff mode >" + getMode() + "<. " + "Allowed modes are " + ArrayUtils.toString(allowedModes) + ".", this); } }