CPD Results
The following document contains the results of PMD's CPD 5.2.1.
Duplications
| File |
Line |
| org/synchronoss/cpo/exporter/CpoClassSourceGenerator.java |
85 |
| org/synchronoss/cpo/exporter/CpoLegacyClassSourceGenerator.java |
57 |
source.append(header);
source.append("\n");
source.append(" /* Properties */\n");
source.append(properties);
source.append("\n");
source.append(" /* Constructor */\n");
source.append(constructor);
source.append("\n");
source.append(" /* Getters and Setters */\n");
source.append(gettersSetters);
// generate equals()
source.append(" public boolean equals(Object o) {\n");
source.append(" if (this == o)\n");
source.append(" return true;\n");
source.append(" if (o == null || getClass() != o.getClass())\n");
source.append(" return false;\n");
source.append("\n");
source.append(" " + className + " that = (" + className + ")o;\n");
source.append("\n");
source.append(equals);
source.append("\n");
source.append(" return true;\n");
source.append(" }\n\n");
// generate hashCode()
source.append(" public int hashCode() {\n");
source.append(" int result = 0;\n");
source.append(" result = 31 * result + getClass().getName().hashCode();\n");
source.append(hashCode);
source.append(" return result;\n");
source.append(" }\n\n");
// generate toString()
source.append(" public String toString() {\n");
source.append(" StringBuilder str = new StringBuilder();\n");
source.append(toString);
source.append(" return str.toString();\n");
source.append(" }\n");
source.append(footer);
source.append("\n");
return source.toString();
}
/**
* The cpoClass name will be used for the name of the interface
*/
protected String generateInterfaceName(CpoClass cpoClass) { |
| File |
Line |
| org/synchronoss/cpo/exporter/CpoClassSourceGenerator.java |
172 |
| org/synchronoss/cpo/exporter/CpoInterfaceSourceGenerator.java |
119 |
constructor.append(" }\n");
}
@Override
public void visit(CpoAttribute cpoAttribute) {
String attName = scrubName(cpoAttribute.getJavaName());
if (cpoAttribute.getTransformClassName()!=null && cpoAttribute.getTransformInMethod()==null) {
try {
cpoAttribute.loadRunTimeInfo(metaDescriptor, null);
} catch (Exception e) {
}
}
// the getter name is get concatenated with the camel case of the attribute name
String getterName;
String setterName;
if (attName.length() > 1) {
getterName = ("get" + attName.substring(0, 1).toUpperCase() + attName.substring(1) + "()");
setterName = ("set" + attName.substring(0, 1).toUpperCase() + attName.substring(1));
} else {
getterName = ("get" + attName.toUpperCase() + "()");
setterName = ("set" + attName.toUpperCase());
}
try {
Class<?> attClass = metaDescriptor.getDataTypeJavaClass(cpoAttribute);
String attClassName = metaDescriptor.getDataTypeName(cpoAttribute); |
| File |
Line |
| org/synchronoss/cpo/exporter/CpoClassSourceGenerator.java |
245 |
| org/synchronoss/cpo/exporter/CpoInterfaceSourceGenerator.java |
158 |
toString.append(" str.append(\"" + attName + " = \" + " + getterName + " + \"\\n\");\n");
} catch(CpoException ce) {
}
}
@Override
public void visit(CpoFunctionGroup cpoFunctionGroup) {
// generate statics for function group
String fgName = cpoFunctionGroup.getName();
if (fgName == null) {
fgName = "NULL";
}
fgName = scrubName(fgName);
String staticName = FG_PREFIX + cpoFunctionGroup.getType() + "_" + fgName.toUpperCase();
if (cpoFunctionGroup.getName() == null) {
functionGroupStatics.append(" public final static String " + staticName + " = null;\n");
} else {
functionGroupStatics.append(" public final static String " + staticName + " = \"" + fgName + "\";\n");
}
}
@Override
public void visit(CpoFunction cpoFunction) {
// nothing to do
}
@Override
public void visit(CpoArgument cpoArgument) {
// nothing to do
}
protected String scrubName(String name) {
return name.replaceAll("[^0-9a-zA-Z_]", "_");
}
} |
| File |
Line |
| org/synchronoss/cpo/CpoByteArrayInputStream.java |
59 |
| org/synchronoss/cpo/CpoCharArrayReader.java |
59 |
protected byte[] getBuffer() {
return buffer_;
}
protected void setOffset(int offset) {
offset_ = offset;
}
protected int getOffset() {
return offset_;
}
protected void setSize(int size) {
size_ = size;
}
protected int getSize() {
return size_;
}
public int getLength() {
int l;
if (getOffset() == 0) {
l = getBuffer().length;
} else {
l = getSize() < getBuffer().length - getOffset() ? getSize() : getBuffer().length - getOffset();
}
return l;
}
static public CpoByteArrayInputStream getCpoStream(InputStream is) { |
| File |
Line |
| org/synchronoss/cpo/meta/bean/CpoClassBean.java |
66 |
| org/synchronoss/cpo/meta/bean/CpoFunctionGroupBean.java |
78 |
if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) {
return false;
}
if (getDescription() != null ? !getDescription().equals(that.getDescription()) : that.getDescription() != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 0;
result = 31 * result + getClass().getName().hashCode();
result = 31 * result + (getName() != null ? getName().hashCode() : 0);
result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0); |