List of usage examples for org.apache.commons.lang3.builder ReflectionToStringBuilder ReflectionToStringBuilder
public ReflectionToStringBuilder(final Object object, final ToStringStyle style)
Constructor.
From source file:com.francetelecom.clara.cloud.logicalmodel.LogicalEntity.java
public String toString() { return (new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) { protected boolean accept(Field f) { return super.accept(f) && !isFieldExcludedFromToString(f.getName()); }//www. j a v a2 s.c o m protected Object getValue(Field field) throws IllegalArgumentException, IllegalAccessException { //Try to sort all of our collections so that toString() comparison is easier Class<?> type = field.getType(); if (List.class.isAssignableFrom(type)) { List list = (List) field.get(this.getObject()); List sortedList = new ArrayList(list); Collections.sort(sortedList); return sortedList; } return field.get(this.getObject()); } }).toString(); }
From source file:com.github.rinde.rinsim.central.GlobalStateObject.java
@Override public String toString() { return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); }
From source file:com.francetelecom.clara.cloud.logicalmodel.LogicalNodeServiceAssociation.java
@Override public String toString() { return (new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) { protected boolean accept(Field f) { return super.accept(f) && !isFieldExcludedFromToString(f.getName()); }/*from w ww. j a v a2s .c om*/ protected Object getValue(Field field) throws IllegalArgumentException, IllegalAccessException { //Try to sort all of our collections so that toString() comparison is easier Class<?> type = field.getType(); if (LogicalModelItem.class.isAssignableFrom(type)) { LogicalModelItem item = (LogicalModelItem) field.get(this.getObject()); return item.getLabel(); } return field.get(this.getObject()); } }).toString(); }
From source file:de.yaio.services.webshot.server.controller.WebshotProvider.java
protected WebShotResultHandler runCommand(final String command, final String[] params, final long jobTimeout) throws IOException { int exitValue; boolean inBackground = false; ExecuteWatchdog watchdog = null;//from w ww .j a v a 2 s. c o m WebShotResultHandler resultHandler; // build up the command line to using a 'java.io.File' final CommandLine commandLine = new CommandLine(command); commandLine.addArguments(params); if (LOGGER.isDebugEnabled()) { LOGGER.debug("start command " + command + " with params" + new ReflectionToStringBuilder(params, ToStringStyle.SHORT_PREFIX_STYLE).toString()); } // create the executor and consider the exitValue '1' as success final Executor executor = new DefaultExecutor(); executor.setExitValue(0); // create a watchdog if requested if (jobTimeout > 0) { watchdog = new ExecuteWatchdog(jobTimeout); executor.setWatchdog(watchdog); } if (inBackground) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("[WebShot] Executing non-blocking WebShot job ..."); } resultHandler = new WebShotResultHandler(watchdog); executor.execute(commandLine, resultHandler); } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("[WebShot] Executing blocking WebShot job ..."); } exitValue = executor.execute(commandLine); resultHandler = new WebShotResultHandler(exitValue); } return resultHandler; }
From source file:com.medlog.webservice.vo.pairs.ToneKeyValuePair.java
public String toCSV() { ReflectionToStringBuilder tsb = new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); tsb.setAppendStatics(false);/*from ww w .j a v a 2s .co m*/ tsb.setExcludeFieldNames("mood", "producivtiy", "row", "diaryID", "rowTotal,shortKey,historicalRawAvg"); String r = tsb.build();//.replace(",", "</li><li>"); r = r.substring(r.indexOf("[") + 1); r = r.replace(",", "|"); r = r.replace("=", ","); return r.replace("]", "").replace("Big5", ""); }
From source file:de.yaio.commons.net.NetFirewall.java
/** * checks if url is allowed/* w w w . ja va2 s .co m*/ * @param url url to check (check protocol, hostname and ip) * @throws PermissionException not allowed * @throws IOExceptionWithCause parsing the url */ public void throwExceptionIfNotAllowed(final String url) throws IOExceptionWithCause, PermissionException { try { if (!isUrlAllowed(url)) { throw new PermissionException("request not allowed by NetFirewall", url, new IOException("request for url:" + url + " not allowed by NetFirewall:" + new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .toString())); } } catch (UnknownHostException ex) { throw new IOExceptionWithCause("unknown host", url, ex); } catch (MalformedURLException ex) { throw new IOExceptionWithCause("malformed url", url, ex); } }
From source file:com.medlog.webservice.vo.DiaryAnalysisVO.java
public String toHTML() { ReflectionToStringBuilder tsb = new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); tsb.setAppendStatics(false);//from w ww .j a va2 s .com String r = tsb.build();//.replace(",", "</li><li>"); r = r.substring(r.indexOf("[")); r = r.replace(",", "</li><li>"); return "<ol><li>" + r.replace("]", "") + "</li></ol>"; }
From source file:com.medlog.webservice.vo.DiaryAnalysisWeightedChartVO.java
public String toCSV() { ReflectionToStringBuilder tsb = new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); tsb.setAppendStatics(false);/* w w w. j a va 2s . c om*/ tsb.setExcludeFieldNames("mood", "producivtiy", "row", "diaryID", "rowTotal"); String r = tsb.build();//.replace(",", "</li><li>"); r = r.substring(r.indexOf("[") + 1); r = r.replace(",", "|"); r = r.replace("=", ","); return r.replace("]", "").replace("Big5", ""); }
From source file:com.medlog.webservice.vo.DiaryAnalysisVO.java
public String toCSV() { ReflectionToStringBuilder tsb = new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); tsb.setAppendStatics(false);//from w w w . j ava2 s . c om tsb.setExcludeFieldNames("mood", "productivity", "row", "diaryID", "rowTotal"); String r = tsb.build();//.replace(",", "</li><li>"); r = r.substring(r.indexOf("[") + 1); r = r.replace(",", "|"); r = r.replace("=", ","); return r.replace("]", "|"); }
From source file:com.lmd.ggzy.domain.GgzyBiddingSubject.java
public String toString() { return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .setExcludeFieldNames("ggzyApplies", "ggzyQualifications", "subjectPerformances").toString(); }