DATACMNS-305 - Added toString() methods to PersistentProperty implementations.

This commit is contained in:
Oliver Gierke
2013-03-28 15:50:17 +01:00
parent fd91313f75
commit e8b2db8463
2 changed files with 31 additions and 0 deletions

View File

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

View File

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