Skip to content

Instantly share code, notes, and snippets.

View gabfssilva's full-sized avatar
🎯
Focusing

Gabriel Francisco gabfssilva

🎯
Focusing
View GitHub Profile
package interceptor;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author Gabriel Francisco - [email protected]
*/
@Retention(RetentionPolicy.RUNTIME)
interface Command<T>{
void execute(T context);
}
class Chain<T>{
private List<Command<T>> commands;
public Chain(List<Command<T>> commands){
this.commands = commands;
}
package org.apache.openejb.tomee.boot;
import javax.ejb.EJB;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
/**
* @author Gabriel Francisco - [email protected]
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="my-persistent-unit" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>dataSource</jta-data-source>
<properties>
public class Repository<T>
public Repository<T> fromEntity(){
return this;
}
public Where<T> where(){
Map<String, Object> parameters = new HashMap<String, Object>;
return new Where<T>(parameters);
}