This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Command<T>{ | |
void execute(T context); | |
} | |
class Chain<T>{ | |
private List<Command<T>> commands; | |
public Chain(List<Command<T>> commands){ | |
this.commands = commands; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Transaction(transactionType: String) | |
trait Payment { | |
def pay(transaction: Transaction): Transaction | |
} | |
class MasterCard extends Payment { | |
override def pay(transaction: Transaction): Transaction = { | |
println("paid with master") | |
transaction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object BSTApp extends App { | |
def maxValue(head: Node, actual: Int = Int.MinValue): Int = head match { | |
case Node(v, null, null) => if (actual > v) actual else v | |
case Node(v, l, null) => maxValue(l, if (actual > v) actual else v) | |
case Node(v, null, r) => maxValue(r, if (actual > v) actual else v) | |
case Node(v, l, r) => | |
val maxLeft = maxValue(r, if (actual > v) actual else v) | |
val maxRight = maxValue(l, if (actual > v) actual else v) | |
if (maxLeft > maxRight) maxLeft else maxRight |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.module.scala.DefaultScalaModule | |
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper | |
import spark.ResponseTransformer | |
import spark.Spark._ | |
object MainClass { | |
val objectMapper = new ObjectMapper with ScalaObjectMapper | |
objectMapper.registerModule(DefaultScalaModule) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=========================================================================== | |
HTTP GET /frodo/api/products/58ac762ce051672d61af1648/events | |
[Header] Host -> 127.0.0.1:33324 | |
=========================================================================== | |
2017-02-21T14:17:36.968-0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58794 #10 (10 connections now open) | |
[mongod output] 2017-02-21 17:17:36 [Thread-11] INFO org.mongodb.driver.connection - Opened connection [connectionId{localValue:10, serverValue:10}] to localhost:27017 | |
--------------------------------------------------------------------------- | |
[Status] Status(200) | |
[Header] Content-Type -> application/json; charset=utf-8 | |
[Header] Content-Length -> 626 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.{Date, UUID} | |
import InMemoryEventStore._ | |
import scala.language.dynamics | |
/** | |
* @author Gabriel Francisco <[email protected]> | |
*/ | |
class DynamicData(var data: Map[String, Any] = Map()) extends Dynamic { |
OlderNewer