CPD Results
The following document contains the results of PMD's CPD 5.3.5.
Duplications
File |
Line |
com\edgardleal\benchmark\example\BeanUtilsExample.java |
64 |
com\edgardleal\benchmark\example\ReflectionExample.java |
28 |
public void timeReflection() {
List<Cliente> list = new ArrayList<Cliente>();
for (int i = 0; i < Benchmark.ITERATIONS; i++) {
Cliente cliente = new Cliente("Teste", 5, 7.7, "Test street");
Cliente second = new Cliente();
try {
Field fields[] = Cliente.class.getDeclaredFields();
for (Field field : fields) {
String capitalizedName = StringUtils.capitalize(field.getName());
Cliente.class.getDeclaredMethod("set" + capitalizedName,
field.getType()).invoke(second,
Cliente.class.getDeclaredMethod("get" + capitalizedName).invoke(cliente, new Class<?>[0])
);
list.add(second);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
} |
File |
Line |
com\edgardleal\benchmark\example\BeanUtilsExample.java |
30 |
com\edgardleal\benchmark\example\GetsetExample.java |
26 |
public void timeGetAndSet() {
List<Cliente> list = new ArrayList<Cliente>();
for (int i = 0; i < Benchmark.ITERATIONS; i++) {
Cliente cliente = new Cliente("Teste", 5, 7.7, "Test street");
Cliente second = new Cliente();
second.setNome(cliente.getNome());
second.setIdade(cliente.getIdade());
second.setSaldo(cliente.getSaldo());
second.setEndereco(cliente.getEndereco());
list.add(second);
}
} |