Skip to content

Instantly share code, notes, and snippets.

@andrus
andrus / gist:d8e138c680af08268cb211f3e239a4fb
Last active April 9, 2017 11:41
Guice Strories Article
public class A {
private B b;
@Inject
public A(B b) {
this.b = b;
}
}
@andrus
andrus / Relationships.java
Created January 20, 2017 14:23
A builder of Cayenne relationships that allows to map them on the fly in a running app.
public class Relationships {
private Class<?> sourceType;
private Class<?> targetType;
private String name;
private String reverseName;
private int cardinalityBits;
private int toDepPKBits;
private Collection<String[]> forwardJoins;
CommitLogListener listener = // custom listener
Module commitLog = CommitLogModule
.extend()
.addListener(listener)
.commitLogAnnotationEntitiesOnly()
.module();
ServerRuntime runtime = ServerRuntime
.builder()
@andrus
andrus / ImperativeBootiqueApp.java
Last active April 12, 2016 14:10
Bootique tip of the day: calling services directly bypassing commands
public class App {
public static void main(String[] args) {
// "Imperative" Bootique style...
// While generally you need to setup command dispatch mechanism to run
// your app, here is an example of "imperative" Bootique. Instead of
// calling Bootique.run(), we create a runtime, get a service out of it,
// and call some methods.
@andrus
andrus / test.java
Last active December 18, 2015 12:28
package com.nhl.league.job;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.nhl.bootique.Bootique;
import com.nhl.bootique.job.runtime.JobBinder;
import com.nhl.league.job.job.CayenneJob;
import com.nhl.league.job.job.LinkMoveJob;
import com.nhl.league.job.job.LongRunningJob;
import com.nhl.league.job.job.ThrowingJob;