Skip to content

Instantly share code, notes, and snippets.

View samuelcatalano-zz's full-sized avatar
Working from home

Samuel Catalano samuelcatalano-zz

Working from home
View GitHub Profile
public static Cache<Integer, List<CountryPublicHolidays>> countryPublicHolidaysCache;
static {
countryPublicHolidaysCache = CacheBuilder.newBuilder()
.expireAfterWrite(20, TimeUnit.MINUTES)
var cachedCountryPublicHolidays = countryPublicHolidaysCache.getIfPresent(currentYear);
# custom IntelliJ IDEA VM options
final ObjectMapper mapper = new ObjectMapper();
try {
usuario = mapper.writeValueAsString(usuarioRaichu);
final Client client = ClientBuilder.newClient();
response = client
.request().header("Authorization", authToken)
.post(Entity.entity(usuario, "application/json"));
samuelcatalano-zz /
Created November 28, 2018 19:40
How to create a Builder
public class ConsumidorBuilder {
private Consumidor consumidor;
public ConsumidorBuilder() {
this.consumidor = new Consumidor();
public ConsumidorBuilder idExterno(String idExterno) {
samuelcatalano-zz /
Last active November 28, 2018 19:41
Returning message error using
// return message error
// catch Expection
JsonObject error = new JsonObject();
error.put("erro", e.getMessage());
return Response.status(HttpStatus.SC_BAD_REQUEST).entity(error.toString()).type(MediaType.APPLICATION_JSON).build();
import java.util.Scanner;
* {@link RGBColors}.
* @author Samuel Catalano
public class RGBColors{