Polish code and JavaDoc formatting
- Remove trailing whitespace - Apply consistent JavaDoc formatting
This commit is contained in:
@@ -72,7 +72,7 @@ public class FormattingConversionService extends GenericConversionService
|
||||
}
|
||||
addFormatterForFieldType(fieldType, formatter);
|
||||
}
|
||||
|
||||
|
||||
public void addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter) {
|
||||
addConverter(new PrinterConverter(fieldType, formatter, this));
|
||||
addConverter(new ParserConverter(fieldType, formatter, this));
|
||||
@@ -105,7 +105,7 @@ public class FormattingConversionService extends GenericConversionService
|
||||
private static class PrinterConverter implements GenericConverter {
|
||||
|
||||
private Class<?> fieldType;
|
||||
|
||||
|
||||
private TypeDescriptor printerObjectType;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -134,11 +134,11 @@ public class FormattingConversionService extends GenericConversionService
|
||||
}
|
||||
return this.printer.print(source, LocaleContextHolder.getLocale());
|
||||
}
|
||||
|
||||
|
||||
private Class<?> resolvePrinterObjectType(Printer<?> printer) {
|
||||
return GenericTypeResolver.resolveTypeArgument(printer.getClass(), Printer.class);
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return this.fieldType.getName() + " -> " + String.class.getName() + " : " + this.printer;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class FormattingConversionService extends GenericConversionService
|
||||
private static class ParserConverter implements GenericConverter {
|
||||
|
||||
private Class<?> fieldType;
|
||||
|
||||
|
||||
private Parser<?> parser;
|
||||
|
||||
private ConversionService conversionService;
|
||||
@@ -189,14 +189,14 @@ public class FormattingConversionService extends GenericConversionService
|
||||
return String.class.getName() + " -> " + this.fieldType.getName() + ": " + this.parser;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class AnnotationPrinterConverter implements ConditionalGenericConverter {
|
||||
|
||||
|
||||
private Class<? extends Annotation> annotationType;
|
||||
|
||||
|
||||
private AnnotationFormatterFactory annotationFormatterFactory;
|
||||
|
||||
|
||||
private Class<?> fieldType;
|
||||
|
||||
public AnnotationPrinterConverter(Class<? extends Annotation> annotationType,
|
||||
@@ -209,11 +209,11 @@ public class FormattingConversionService extends GenericConversionService
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(fieldType, String.class));
|
||||
}
|
||||
|
||||
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return sourceType.getAnnotation(annotationType) != null;
|
||||
}
|
||||
|
||||
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
AnnotationConverterKey converterKey = new AnnotationConverterKey(sourceType.getAnnotation(annotationType), sourceType.getObjectType());
|
||||
GenericConverter converter = cachedPrinters.get(converterKey);
|
||||
@@ -224,19 +224,19 @@ public class FormattingConversionService extends GenericConversionService
|
||||
}
|
||||
return converter.convert(source, sourceType, targetType);
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return "@" + annotationType.getName() + " " + fieldType.getName() + " -> " + String.class.getName() + ": " + annotationFormatterFactory;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class AnnotationParserConverter implements ConditionalGenericConverter {
|
||||
|
||||
|
||||
private Class<? extends Annotation> annotationType;
|
||||
|
||||
|
||||
private AnnotationFormatterFactory annotationFormatterFactory;
|
||||
|
||||
|
||||
private Class<?> fieldType;
|
||||
|
||||
public AnnotationParserConverter(Class<? extends Annotation> annotationType,
|
||||
@@ -249,11 +249,11 @@ public class FormattingConversionService extends GenericConversionService
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(String.class, fieldType));
|
||||
}
|
||||
|
||||
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return targetType.getAnnotation(annotationType) != null;
|
||||
}
|
||||
|
||||
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
AnnotationConverterKey converterKey = new AnnotationConverterKey(targetType.getAnnotation(annotationType), targetType.getObjectType());
|
||||
GenericConverter converter = cachedParsers.get(converterKey);
|
||||
@@ -264,32 +264,32 @@ public class FormattingConversionService extends GenericConversionService
|
||||
}
|
||||
return converter.convert(source, sourceType, targetType);
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return String.class.getName() + " -> @" + annotationType.getName() + " " + fieldType.getName() + ": " + annotationFormatterFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class AnnotationConverterKey {
|
||||
|
||||
|
||||
private final Annotation annotation;
|
||||
|
||||
|
||||
private final Class<?> fieldType;
|
||||
|
||||
|
||||
public AnnotationConverterKey(Annotation annotation, Class<?> fieldType) {
|
||||
this.annotation = annotation;
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
|
||||
public Annotation getAnnotation() {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
|
||||
public Class<?> getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof AnnotationConverterKey)) {
|
||||
return false;
|
||||
@@ -297,10 +297,10 @@ public class FormattingConversionService extends GenericConversionService
|
||||
AnnotationConverterKey key = (AnnotationConverterKey) o;
|
||||
return this.annotation.equals(key.annotation) && this.fieldType.equals(key.fieldType);
|
||||
}
|
||||
|
||||
|
||||
public int hashCode() {
|
||||
return this.annotation.hashCode() + 29 * this.fieldType.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user