Skip to content

Commit

Permalink
Finalizando a inserção do Lombok no projeto...
Browse files Browse the repository at this point in the history
  • Loading branch information
WenderGalan committed Nov 24, 2019
1 parent 1c79e74 commit f9d70eb
Show file tree
Hide file tree
Showing 19 changed files with 122 additions and 915 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ExceptionHandlerInterceptor extends ResponseEntityExceptionHandler

@ExceptionHandler(Exception.class)
protected ResponseEntity<Object> getException(Exception ex, WebRequest request) {
Crashlytics crashlytics = new Crashlytics();
Crashlytics crashlytics = Crashlytics.builder().build();

crashlytics.setClassError(ex.getStackTrace()[0].getClassName());
crashlytics.setMethodName(ex.getStackTrace()[0].getMethodName());
Expand Down Expand Up @@ -65,10 +65,10 @@ protected ResponseEntity<Object> getException(Exception ex, WebRequest request)
/**Seta os headers da request**/
Iterator<String> names = request.getHeaderNames();
List<Header> headers = new ArrayList<>();
while (names.hasNext()){
while (names.hasNext()) {
String name = names.next();
String value = request.getHeader(name);
Header header = new Header(name, value, crashlytics);
Header header = Header.builder().key(name).value(value).crashlytics(crashlytics).build();
headers.add(header);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,68 +1,23 @@
package com.casafacilimoveis.model.beans;

import com.casafacilimoveis.model.enums.CodeError;
import lombok.Builder;
import lombok.Data;

/**
* casa-facil-imoveis
* Wender Galan
* Todos os direitos reservados ©
**********************************************
* *********************************************
* Nome do arquivo: ResponseError.java
* Criado por : Wender Galan
* Data da criação :
* Observação :
**********************************************
* *********************************************
*/
@Data
@Builder
public class ResponseError {

private CodeError code;
private String message;

/**
* Instantiates a new Response error.
*
* @param code the code
*/
public ResponseError(CodeError code) {
this.code = code;
}

/**
* Instantiates a new Response error.
*
* @param code the code
* @param message the message
*/
public ResponseError(CodeError code, String message) {
this.code = code;
this.message = message;
}

/**
* Gets code.
*
* @return the code
*/
public int getCode() {
return code != null ? code.getCode() : 0;
}

/**
* Gets message.
*
* @return the message
*/
public String getMessage() {
return message;
}

/**
* Sets message.
*
* @param message the message
*/
public void setMessage(String message) {
this.message = message;
}

}
Original file line number Diff line number Diff line change
@@ -1,91 +1,22 @@
package com.casafacilimoveis.model.beans;

import lombok.Builder;
import lombok.Data;

/**
* casa-facil-imoveis
* Wender Galan
* Todos os direitos reservados ©
**********************************************
* *********************************************
* Nome do arquivo: Validation.java
* Criado por : Wender Galan
* Data da criação :
* Observação :
**********************************************
* *********************************************
*/
@Data
@Builder
public class Validation {

private String campo;
private String mensagem;

/**
* Instantiates a new Validation.
*/
public Validation() {
}

/**
* Instantiates a new Validation.
*
* @param campo the campo
* @param mensagem the mensagem
*/
public Validation(String campo, String mensagem) {
this.campo = campo;
this.mensagem = mensagem;
}

/**
* Gets .
*
* @return the
*/
public String getcampo() {
return campo;
}

/**
* Sets .
*
* @param campo the campo
*/
public void setcampo(String campo) {
this.campo = campo;
}

/**
* Gets .
*
* @return the
*/
public String getmensagem() {
return mensagem;
}

/**
* Sets .
*
* @param mensagem the mensagem
*/
public void setmensagem(String mensagem) {
this.mensagem = mensagem;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

Validation that = (Validation) o;

if (campo != null ? !campo.equals(that.campo) : that.campo != null) return false;
return !(mensagem != null ? !mensagem.equals(that.mensagem) : that.mensagem != null);

}

@Override
public int hashCode() {
int result = campo != null ? campo.hashCode() : 0;
result = 31 * result + (mensagem != null ? mensagem.hashCode() : 0);
return result;
}

}
Loading

0 comments on commit f9d70eb

Please sign in to comment.