
org.openclover.util.Objects Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clover Show documentation
Show all versions of clover Show documentation
Clover is an award winning code coverage and testing tool for Java and Groovy.
It integrates easily with Maven, Ant, Grails, Eclipse and IntelliJ IDEA
as well as with continuous integration servers such as Bamboo, Jenkins or Hudson.
Note: before Clover 4.0 this artifact was named com.cenqua.clover:clover.
The newest version!
package org.openclover.util;
import org.jetbrains.annotations.Nullable;
public abstract class Objects {
public static ToStringBuilder toStringBuilder(Object object) {
return toStringBuilder(object.getClass());
}
public static ToStringBuilder toStringBuilder(Class> clazz) {
return new ToStringBuilder(clazz);
}
public static class ToStringBuilder {
private final StringBuilder content;
private ToStringBuilder(Class> clazz) {
content = new StringBuilder(clazz.getSimpleName() + "{");
}
public ToStringBuilder add(String fieldName, @Nullable T fieldValue) {
content.append(fieldName)
.append("=")
.append(fieldValue == null ? "null" : fieldValue.toString())
.append(",");
return this;
}
public String toString() {
return content.toString() + "}";
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy