javadoc / to string

This commit is contained in:
Keith Donald
2008-03-18 21:14:32 +00:00
parent 0848321f5d
commit 689b393605
8 changed files with 48 additions and 0 deletions

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}