List of usage examples for org.apache.commons.lang.builder ToStringStyle MULTI_LINE_STYLE
ToStringStyle MULTI_LINE_STYLE
To view the source code for org.apache.commons.lang.builder ToStringStyle MULTI_LINE_STYLE.
Click Source Link
From source file:com.gemini.mapper.URLCustomConverter.java
@Override public Object convert(Object destValue, Object sourceValue, Class<?> destinationClass, Class<?> sourceClass) { if (sourceValue == null) { Logger.error("URL Custom Converter used incorrectly, NULL values passed"); return null; }//from w w w.jav a 2 s.c o m if (sourceValue instanceof String) { try { //convert String to URL URL url = new URL((String) sourceValue); return url; } catch (MalformedURLException ex) { Logger.info("URL Custom Converter used incorrectly, invalid URL supplied as source: {}", (String) sourceValue); } } else if (sourceValue instanceof URL) { return ((URL) sourceValue).toString(); } else { Logger.error( "URL Custom Converterr used incorrectly. Arguments passed in were: source\n {} \n destination\n {}", ToStringBuilder.reflectionToString(sourceValue, ToStringStyle.MULTI_LINE_STYLE), ToStringBuilder.reflectionToString(destValue, ToStringStyle.MULTI_LINE_STYLE)); throw new MappingException("Converter TestCustomConverter used incorrectly. Arguments passed in were:" + ToStringBuilder.reflectionToString(destValue, ToStringStyle.MULTI_LINE_STYLE) + " and " + ToStringBuilder.reflectionToString(sourceValue, ToStringStyle.MULTI_LINE_STYLE)); } return null; }
From source file:com.gemini.mapper.IPAddressTypeCustomConverter.java
@Override public Object convert(Object destValue, Object sourceValue, Class<?> destinationClass, Class<?> sourceClass) { if (sourceValue == null) { Logger.error("IP Address Type Custom Converter used incorrectly, NULL values passed"); return null; }//w ww . j a v a2 s . co m if (sourceValue instanceof String) { //convert String to GeminiEnvironmentType for (IPAddressType envType : IPAddressType.values()) { if (envType.name().equals((String) sourceValue)) { return envType; } } Logger.error("IP Address Type converter used incorrectly - invalid address type {}", (String) sourceValue); } else if (sourceValue instanceof IPAddressType) { return ((IPAddressType) sourceValue).name(); } else { Logger.error( "IP Address Custom Converter used incorrectly. Arguments passed in were: source\n {} \n destination\n {}", ToStringBuilder.reflectionToString(sourceValue, ToStringStyle.MULTI_LINE_STYLE), ToStringBuilder.reflectionToString(destValue, ToStringStyle.MULTI_LINE_STYLE)); throw new MappingException("Converter TestCustomConverter used incorrectly. Arguments passed in were:" + ToStringBuilder.reflectionToString(destValue, ToStringStyle.MULTI_LINE_STYLE) + " and " + ToStringBuilder.reflectionToString(sourceValue, ToStringStyle.MULTI_LINE_STYLE)); } return null; }
From source file:com.gemini.domain.repository.impl.GeminiNetworkRepositoryMongoDBImpl.java
public GeminiNetwork getNetByStartAndEnd(String start, String end) { Datastore ds = getDatastore();/* ww w. j a v a2 s. c om*/ if (ds == null) { Logger.error("get networks by start and end - no datastore:{} to {}", start, end); return null; } Logger.debug("get networks by start and end - build query", ToStringBuilder .reflectionToString(this.getClass().getSimpleName(), ToStringStyle.MULTI_LINE_STYLE)); List<GeminiNetwork> retList = ds.find(GeminiNetwork.class).filter("start", InetAddresses.forString(start)) .filter("end", InetAddresses.forString(end)).asList(); for (GeminiNetwork n : retList) { //return the first one in the list Logger.debug("get networks by start and end - found networks:{} to {}", start, end); return n; } Logger.debug("get networks by start and end - did not find the networks:{} to {}", start, end); return null; }
From source file:MainClass.java
public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("Name", name).append("Age", age) .toString();/*from ww w.j ava2s . c o m*/ }
From source file:com.indexoutofbounds.util.ReflectionObject.java
/** * toString() which uses Jakarta-Commons ReflecttionToStringBuilder. * // www.j a v a2 s . c o m * @return String reprensentation. */ public String toString() { return ReflectionToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); }
From source file:com.supermap.desktop.icloud.commontypes.LicenseInfo.java
public String toString() { return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); }
From source file:com.pieframework.model.system.Service.java
@Override public String toString() { ReflectionToStringBuilder.setDefaultStyle(ToStringStyle.MULTI_LINE_STYLE); return ReflectionToStringBuilder.toString(this); }
From source file:com.discursive.jccook.lang.builders.customized.PoliticalCandidate.java
public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("lastName", lastName) .append("firstName", firstName).toString(); }
From source file:com.gemini.common.repository.impl.BaseRepositoryMongoDBImpl.java
@Override public void update(String id, T transientObject) { Logger.debug("update: id: {} object: ", ToStringBuilder.reflectionToString(id, ToStringStyle.MULTI_LINE_STYLE), ToStringBuilder.reflectionToString(transientObject, ToStringStyle.MULTI_LINE_STYLE)); save(transientObject);/*w ww.j a v a 2 s. c o m*/ }
From source file:com.gemini.mapper.SecurityGroupRuleDirectionCustomConverter.java
@Override public Object convert(Object destValue, Object sourceValue, Class<?> destinationClass, Class<?> sourceClass) { if (sourceValue == null) { Logger.error("Security Group Rule Direction Custom Converter used incorrectly, NULL values passed"); return null; }/*from www . j av a 2s . co m*/ if (sourceValue instanceof String) { //convert String to GeminiEnvironmentType for (GeminiSecurityGroupRuleDirection envType : GeminiSecurityGroupRuleDirection.values()) { if (envType.name().equals((String) sourceValue)) { return envType; } } Logger.error( "Security Group Rule Direction Custom Converter used incorrectly, invalid value passed: {}", (String) sourceValue); } else if (sourceValue instanceof GeminiSecurityGroupRuleDirection) { return ((GeminiSecurityGroupRuleDirection) sourceValue).name(); } else { Logger.error( "Security Group Rule Direction Custom Converter used incorrectly. Arguments passed in were: source\n {} \n destination\n {}", ToStringBuilder.reflectionToString(sourceValue, ToStringStyle.MULTI_LINE_STYLE), ToStringBuilder.reflectionToString(destValue, ToStringStyle.MULTI_LINE_STYLE)); throw new MappingException( "Converter SecurityGroupRuleDirectionCustomConverter used incorrectly. Arguments passed in were:" + ToStringBuilder.reflectionToString(destValue, ToStringStyle.MULTI_LINE_STYLE) + " and " + ToStringBuilder.reflectionToString(sourceValue, ToStringStyle.MULTI_LINE_STYLE)); } return null; }