I hereby claim:
- I am mpellegrini on github.
- I am mpellegrini (https://keybase.io/mpellegrini) on keybase.
- I have a public key ASCJzHB0u-QGRLctjx9M5lAJx3bsi5zOGQMbNmH6GWJt-go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
package com.michaelpellegrini.example.functional; | |
import io.vavr.Function1; | |
import io.vavr.collection.List; | |
import static io.vavr.API.$; | |
import static io.vavr.API.Case; | |
import static io.vavr.API.Match; | |
import static io.vavr.Predicates.instanceOf; |
import org.jboss.resteasy.annotations.interception.ServerInterceptor; | |
import org.jboss.resteasy.core.ResourceMethod; | |
import org.jboss.resteasy.core.ServerResponse; | |
import org.jboss.resteasy.spi.Failure; | |
import org.jboss.resteasy.spi.HttpRequest; | |
import org.jboss.resteasy.spi.interception.MessageBodyWriterContext; | |
import org.jboss.resteasy.spi.interception.MessageBodyWriterInterceptor; | |
import org.jboss.resteasy.spi.interception.PreProcessInterceptor; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
public class LocalDateBinder implements Binder<Bind, LocalDate> { | |
@Override | |
public void bind(SQLStatement<?> stmt, Bind bind, LocalDate localDate) { | |
stmt.bind(bind.value(), localDate.format(DateTimeFormatter.ISO_LOCAL_DATE)); | |
} | |
} |
import javax.naming.Context; | |
import javax.naming.NamingEnumeration; | |
import javax.naming.NamingException; | |
import javax.naming.directory.Attributes; | |
import javax.naming.directory.DirContext; | |
import javax.naming.directory.InitialDirContext; | |
import javax.naming.spi.NamingManager; | |
import java.net.InetSocketAddress; | |
import java.util.ArrayList; | |
import java.util.Collection; |
// Create a configuration | |
Configuration configuration = new Configuration(); | |
//Create a CacheManager using defaults | |
CacheManager manager = CacheManager.create(configuration); | |
//Create a Cache specifying its configuration. | |
Cache testCache = new Cache( | |
new CacheConfiguration("test", maxElements) | |
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) |
<?xml version="1.0" encoding="UTF-8"?> | |
<web-fragment version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"> | |
<display-name>display-name</display-name> | |
<description>description</description> | |
</web-fragment> | |
// Better | |
public static boolean isEqual(byte[] a, byte[] b) { | |
if (a.length != b.length) { | |
return false; | |
} | |
int result = 0; | |
for (int i = 0; i < a.length; i++) { | |
result |= a[i] ^ b[i] | |
} |
<!-- | |
For WAR files, use WEB-INF/beans.xml. In a Maven WAR module, this will be src/main/webapp/WEB-INF/beans.xml. | |
For EJB-JAR files or ordinary JAR files, use META-INF/beans.xml. In a Maven module, this will be src/main/resources/META-INF/beans.xml. | |
--> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation=" | |
http://java.sun.com/xml/ns/javaee | |
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import javax.enterprise.event.Observes; | |
import javax.enterprise.inject.spi.AfterBeanDiscovery; | |
import javax.enterprise.inject.spi.AfterDeploymentValidation; | |
import javax.enterprise.inject.spi.BeforeBeanDiscovery; | |
import javax.enterprise.inject.spi.BeforeShutdown; | |
import javax.enterprise.inject.spi.Extension; | |
import javax.enterprise.inject.spi.ProcessAnnotatedType; |