Skip to content

Commit 5d3e9ac

Browse files
committed
Removido commons-lang: utilizando Google Guava.
1 parent e49c53e commit 5d3e9ac

14 files changed

Lines changed: 63 additions & 69 deletions

File tree

‎pom.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
</repositories>
4949
<dependencies>
5050
<dependency>
51-
<groupId>commons-lang</groupId>
52-
<artifactId>commons-lang</artifactId>
53-
<version>2.5</version>
51+
<groupId>com.google.guava</groupId>
52+
<artifactId>guava</artifactId>
53+
<version>11.0.2</version>
5454
</dependency>
5555
<dependency>
5656
<groupId>org.slf4j</groupId>

‎src/main/java/br/com/insula/opes/Agencia.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
import java.util.Formattable;
88
import java.util.Formatter;
99

10-
import org.apache.commons.lang.builder.EqualsBuilder;
11-
import org.apache.commons.lang.builder.HashCodeBuilder;
12-
1310
import br.com.insula.opes.util.Assert;
1411

12+
import com.google.common.base.Objects;
13+
1514
public class Agencia implements Serializable, Formattable {
1615

1716
private static final long serialVersionUID = 1L;
@@ -32,14 +31,14 @@ public boolean equals(Object obj) {
3231
}
3332
if (obj instanceof Agencia) {
3433
Agencia other = (Agencia) obj;
35-
return new EqualsBuilder().append(this.numero, other.numero).append(this.dv, other.dv).isEquals();
34+
return Objects.equal(this.numero, other.numero) && Objects.equal(this.dv, other.dv);
3635
}
3736
return false;
3837
}
3938

4039
@Override
4140
public int hashCode() {
42-
return new HashCodeBuilder().append(this.numero).append(this.dv).toHashCode();
41+
return Objects.hashCode(this.numero, this.dv);
4342
}
4443

4544
@Override

‎src/main/java/br/com/insula/opes/Cep.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
import java.util.Formattable;
2424
import java.util.Formatter;
2525

26-
import org.apache.commons.lang.builder.EqualsBuilder;
27-
import org.apache.commons.lang.builder.HashCodeBuilder;
28-
2926
import br.com.insula.opes.util.Assert;
3027

28+
import com.google.common.base.Objects;
29+
3130
public class Cep implements Serializable, Formattable {
3231

3332
private static final long serialVersionUID = 1L;
@@ -45,14 +44,14 @@ public boolean equals(Object obj) {
4544
}
4645
if (obj instanceof Cep) {
4746
Cep other = (Cep) obj;
48-
return new EqualsBuilder().append(this.numero, other.numero).isEquals();
47+
return Objects.equal(this.numero, other.numero);
4948
}
5049
return false;
5150
}
5251

5352
@Override
5453
public int hashCode() {
55-
return new HashCodeBuilder().append(this.numero).toHashCode();
54+
return Objects.hashCode(this.numero);
5655
}
5756

5857
@Override

‎src/main/java/br/com/insula/opes/CertificadoDigital.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public byte[] getBytes() {
118118
return bytes;
119119
}
120120

121-
public Node sign(Node node) {
121+
public <T extends Node> T sign(T node) {
122122
Assert.notNull(node);
123123
Assert.isTrue(node instanceof Document || node instanceof Element);
124124
try {
@@ -212,17 +212,16 @@ private Object readResolve() {
212212

213213
private static class X509KeySelector extends KeySelector {
214214

215+
@Override
215216
public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method,
216217
XMLCryptoContext context) throws KeySelectorException {
217218

218-
@SuppressWarnings("unchecked")
219219
Iterator<XMLStructure> ki = keyInfo.getContent().iterator();
220220

221221
while (ki.hasNext()) {
222222
XMLStructure info = ki.next();
223223
if (info instanceof X509Data) {
224224
X509Data x509Data = (X509Data) info;
225-
@SuppressWarnings("unchecked")
226225
Iterator<Object> xi = x509Data.getContent().iterator();
227226
while (xi.hasNext()) {
228227
Object o = xi.next();
@@ -231,6 +230,7 @@ public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, Al
231230
final PublicKey key = ((X509Certificate) o).getPublicKey();
232231
if (algEquals(method.getAlgorithm(), key.getAlgorithm())) {
233232
return new KeySelectorResult() {
233+
@Override
234234
public Key getKey() {
235235
return key;
236236
}

‎src/main/java/br/com/insula/opes/Cnpj.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
import java.util.Formattable;
2424
import java.util.Formatter;
2525

26-
import org.apache.commons.lang.builder.EqualsBuilder;
27-
import org.apache.commons.lang.builder.HashCodeBuilder;
28-
2926
import br.com.insula.opes.util.Assert;
3027

28+
import com.google.common.base.Objects;
29+
3130
public class Cnpj implements Serializable, Formattable {
3231

3332
private static final long serialVersionUID = 1L;
@@ -96,14 +95,14 @@ public boolean equals(Object obj) {
9695
}
9796
if (obj instanceof Cnpj) {
9897
Cnpj other = (Cnpj) obj;
99-
return new EqualsBuilder().append(this.numero, other.numero).isEquals();
98+
return Objects.equal(this.numero, other.numero);
10099
}
101100
return false;
102101
}
103102

104103
@Override
105104
public int hashCode() {
106-
return new HashCodeBuilder().append(this.numero).toHashCode();
105+
return Objects.hashCode(this.numero);
107106
}
108107

109108
@Override

‎src/main/java/br/com/insula/opes/ContaCorrente.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
import java.util.Formattable;
88
import java.util.Formatter;
99

10-
import org.apache.commons.lang.builder.EqualsBuilder;
11-
import org.apache.commons.lang.builder.HashCodeBuilder;
12-
1310
import br.com.insula.opes.util.Assert;
1411

12+
import com.google.common.base.Objects;
13+
1514
public class ContaCorrente implements Serializable, Formattable {
1615

1716
private static final long serialVersionUID = 1L;
@@ -32,14 +31,14 @@ public boolean equals(Object obj) {
3231
}
3332
if (obj instanceof ContaCorrente) {
3433
ContaCorrente other = (ContaCorrente) obj;
35-
return new EqualsBuilder().append(this.numero, other.numero).append(this.dv, other.dv).isEquals();
34+
return Objects.equal(this.numero, other.numero) && Objects.equal(this.dv, other.dv);
3635
}
3736
return false;
3837
}
3938

4039
@Override
4140
public int hashCode() {
42-
return new HashCodeBuilder().append(this.numero).append(this.dv).toHashCode();
41+
return Objects.hashCode(this.numero, this.dv);
4342
}
4443

4544
@Override

‎src/main/java/br/com/insula/opes/Cpf.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
import java.util.Formattable;
2424
import java.util.Formatter;
2525

26-
import org.apache.commons.lang.builder.EqualsBuilder;
27-
import org.apache.commons.lang.builder.HashCodeBuilder;
28-
2926
import br.com.insula.opes.util.Assert;
3027

28+
import com.google.common.base.Objects;
29+
3130
public class Cpf implements Serializable, Formattable {
3231

3332
private static final long serialVersionUID = 1L;
@@ -92,14 +91,14 @@ public boolean equals(Object obj) {
9291
}
9392
if (obj instanceof Cpf) {
9493
Cpf other = (Cpf) obj;
95-
return new EqualsBuilder().append(this.numero, other.numero).isEquals();
94+
return Objects.equal(this.numero, other.numero);
9695
}
9796
return false;
9897
}
9998

10099
@Override
101100
public int hashCode() {
102-
return new HashCodeBuilder().append(this.numero).toHashCode();
101+
return Objects.hashCode(this.numero);
103102
}
104103

105104
@Override

‎src/main/java/br/com/insula/opes/CpfCnpj.java‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
import java.util.Formattable;
2121
import java.util.Formatter;
2222

23-
import org.apache.commons.lang.builder.EqualsBuilder;
24-
import org.apache.commons.lang.builder.HashCodeBuilder;
23+
import com.google.common.base.Objects;
2524

2625
public class CpfCnpj implements Serializable, Formattable {
2726

@@ -66,14 +65,14 @@ public boolean equals(Object obj) {
6665
}
6766
if (obj instanceof CpfCnpj) {
6867
CpfCnpj other = (CpfCnpj) obj;
69-
return new EqualsBuilder().append(this.cpf, other.cpf).append(this.cnpj, other.cnpj).isEquals();
68+
return Objects.equal(this.cpf, other.cpf) && Objects.equal(this.cnpj, other.cnpj);
7069
}
7170
return false;
7271
}
7372

7473
@Override
7574
public int hashCode() {
76-
return new HashCodeBuilder().append(this.cpf).append(this.cnpj).toHashCode();
75+
return Objects.hashCode(this.cpf, this.cnpj);
7776
}
7877

7978
@Override

‎src/main/java/br/com/insula/opes/Email.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
import java.util.regex.Matcher;
2121
import java.util.regex.Pattern;
2222

23-
import org.apache.commons.lang.builder.EqualsBuilder;
24-
import org.apache.commons.lang.builder.HashCodeBuilder;
25-
2623
import br.com.insula.opes.util.Assert;
2724

25+
import com.google.common.base.Objects;
26+
2827
public class Email implements Serializable {
2928

3029
private static final long serialVersionUID = 1L;
@@ -51,14 +50,14 @@ public boolean equals(Object obj) {
5150
}
5251
if (obj instanceof Email) {
5352
Email other = (Email) obj;
54-
return new EqualsBuilder().append(this.value, other.value).isEquals();
53+
return Objects.equal(this.value, other.value);
5554
}
5655
return false;
5756
}
5857

5958
@Override
6059
public int hashCode() {
61-
return new HashCodeBuilder().append(this.value).toHashCode();
60+
return Objects.hashCode(this.value);
6261
}
6362

6463
@Override

‎src/main/java/br/com/insula/opes/InscricaoEstadual.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
import java.io.Serializable;
44

5-
import org.apache.commons.lang.builder.EqualsBuilder;
6-
import org.apache.commons.lang.builder.HashCodeBuilder;
7-
85
import br.com.insula.opes.util.Assert;
96

7+
import com.google.common.base.Objects;
8+
109
public class InscricaoEstadual implements Serializable {
1110

1211
private static final long serialVersionUID = 1L;
@@ -42,14 +41,14 @@ public boolean equals(Object obj) {
4241
}
4342
if (obj instanceof InscricaoEstadual) {
4443
InscricaoEstadual other = (InscricaoEstadual) obj;
45-
return new EqualsBuilder().append(this.value, other.value).isEquals();
44+
return Objects.equal(this.value, other.value);
4645
}
4746
return false;
4847
}
4948

5049
@Override
5150
public int hashCode() {
52-
return new HashCodeBuilder().append(this.value).toHashCode();
51+
return Objects.hashCode(this.value);
5352
}
5453

5554
}

0 commit comments

Comments
 (0)