DATACMNS-305 - Added toString() methods to PersistentProperty implementations.
This commit is contained in:
@@ -309,4 +309,13 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
public int hashCode() {
|
||||
return this.field.hashCode();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s.%s : %s", getOwner().getType().getName(), getName(), getType().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,4 +206,26 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
|
||||
protected boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
|
||||
return findAnnotation(annotationType) != null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.model.AbstractPersistentProperty#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
if (annotationCache.isEmpty()) {
|
||||
populateAnnotationCache(field);
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (Annotation annotation : annotationCache.values()) {
|
||||
if (annotation != null) {
|
||||
builder.append(annotation.toString()).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString() + super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user