javadoc / to string
This commit is contained in:
@@ -7,6 +7,7 @@ import java.util.Date;
|
||||
import org.springframework.binding.format.Formatter;
|
||||
import org.springframework.binding.format.FormatterFactory;
|
||||
import org.springframework.binding.format.FormatterFactoryContext;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
|
||||
/**
|
||||
* Factory for date formatters.
|
||||
@@ -54,6 +55,10 @@ public class DateFormatterFactory implements FormatterFactory {
|
||||
return dateFormat.parse(formattedString);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringCreator(this).append("format", dateFormat).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.text.NumberFormat;
|
||||
import org.springframework.binding.format.Formatter;
|
||||
import org.springframework.binding.format.FormatterFactory;
|
||||
import org.springframework.binding.format.FormatterFactoryContext;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
import org.springframework.util.NumberUtils;
|
||||
|
||||
/**
|
||||
@@ -70,5 +71,10 @@ public class NumberFormatterFactory implements FormatterFactory {
|
||||
return NumberUtils.parseNumber(text, targetClass);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringCreator(this).append("format", numberFormat).append("targetClass", targetClass)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import java.util.List;
|
||||
import org.springframework.binding.mapping.MappingResult;
|
||||
import org.springframework.binding.mapping.MappingResults;
|
||||
import org.springframework.binding.mapping.MappingResultsCriteria;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Default mapping results implementation.
|
||||
@@ -80,4 +83,12 @@ public class DefaultMappingResults implements MappingResults {
|
||||
return Collections.unmodifiableList(results);
|
||||
}
|
||||
|
||||
protected String toStringCreator() {
|
||||
String sourceString = ClassUtils.getShortName(source.getClass()) + "@"
|
||||
+ ObjectUtils.getIdentityHexString(source);
|
||||
String targetString = ClassUtils.getShortName(target.getClass()) + "@"
|
||||
+ ObjectUtils.getIdentityHexString(target);
|
||||
return new ToStringCreator(this).append("source", sourceString).append("target", targetString).append(
|
||||
"results", mappingResults).toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.springframework.binding.mapping.results;
|
||||
|
||||
import org.springframework.binding.mapping.Result;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
|
||||
/**
|
||||
* The "required" error result--indicates a required mapping could not be performed because the source value to map was
|
||||
@@ -34,4 +35,8 @@ public class RequiredError extends Result {
|
||||
public String getErrorCode() {
|
||||
return "required";
|
||||
}
|
||||
|
||||
protected String toStringCreator() {
|
||||
return new ToStringCreator(this).append("originalValue", originalValue).toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.springframework.binding.mapping.results;
|
||||
import org.springframework.binding.expression.EvaluationException;
|
||||
import org.springframework.binding.expression.PropertyNotFoundException;
|
||||
import org.springframework.binding.mapping.Result;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
|
||||
/**
|
||||
* Indicates an exception occurred accessing the source object to be mapped. Used to report source
|
||||
@@ -48,4 +49,8 @@ public class SourceAccessError extends Result {
|
||||
}
|
||||
}
|
||||
|
||||
protected String toStringCreator() {
|
||||
return new ToStringCreator(this).append("error", error).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.springframework.binding.mapping.results;
|
||||
|
||||
import org.springframework.binding.mapping.Result;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
|
||||
/**
|
||||
* Indicates a successful mapping operation.
|
||||
@@ -37,4 +38,9 @@ public class Success extends Result {
|
||||
public String getErrorCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String toStringCreator() {
|
||||
return new ToStringCreator(this).append("mappedValue", mappedValue).append("originalValue", originalValue)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.springframework.binding.mapping.results;
|
||||
import org.springframework.binding.expression.EvaluationException;
|
||||
import org.springframework.binding.expression.PropertyNotFoundException;
|
||||
import org.springframework.binding.mapping.Result;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
|
||||
/**
|
||||
* Indicates an exception occurred accessing the target object to be mapped to. Used to report source
|
||||
@@ -51,4 +52,8 @@ public class TargetAccessError extends Result {
|
||||
return "targetAccess";
|
||||
}
|
||||
}
|
||||
|
||||
protected String toStringCreator() {
|
||||
return new ToStringCreator(this).append("error", error).toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.springframework.binding.mapping.results;
|
||||
|
||||
import org.springframework.binding.mapping.Result;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
|
||||
/**
|
||||
* Indicates a type conversion occurred during a mapping operation.
|
||||
@@ -48,4 +49,8 @@ public class TypeConversionError extends Result {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
protected String toStringCreator() {
|
||||
return new ToStringCreator(this).append("originalValue", originalValue).append("targetType", targetType)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user