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
protected Collection<Object> createCollection(Type type) | |
{ | |
// support reusing existing implementations | |
if (datastore.refresh != null) | |
{ | |
@SuppressWarnings("unchecked") | |
Collection<Object> result = (Collection<Object>) datastore.refresh; | |
datastore.refresh = null; | |
return result; | |
} |
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
class CountingThread extends Thread { | |
private final int maxCount; | |
private final CountingThread terminationThread; | |
private boolean stopped = false; | |
public CountingThread(int maxCount, CountingThread terminationThread) { | |
this.maxCount = maxCount; | |
this.terminationThread = terminationThread; | |
} |
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 ChangeLoggers { | |
customer, @Named("CUSTOMER_NAME") String customerName); | |
public static <T> T create(Class<? extends ChangeLogger> clazz, final CurrentUser currentUser, final ChangeLogBase base) { | |
return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[]{clazz}, new InvocationHandler() { | |
public Object invoke(Object o, Method method, Object[] objects) throws Throwable { |
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
static class Parent { | |
@Id | |
Long id; | |
} | |
static class Child { | |
@Id | |
Long id; |
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
static class Person { | |
@Id | |
private Long id; | |
@Embedded(polymorphic = true) | |
private State state; | |
} | |
static class State { | |
private String value; |
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
static class Person { | |
@Id | |
private Long id; | |
@Embedded(polymorphic = true) | |
private State state; | |
} | |
static class State { | |
private String value; |
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 interface Child1 extends ValueProxy { | |
String getValue(); | |
void setValue(String value); | |
Long getId(); | |
void setId(Long id); | |
} |
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 MockitoBehaviorTest { | |
interface Registry { | |
void register(Double amount); | |
} | |
class PaymentProcessingListener { | |
private final Registry registry; |
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 MessyBehaviorTest { | |
interface Registry { | |
void register(Double amount); | |
} | |
class PaymentProcessingListener { | |
private final Registry registry; |
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
@Override | |
protected CombinedConverter createTypeConverter() { | |
CombinedConverter converter = new CombinedConverter(); | |
converter.append(new PrimitiveConverter()); | |
converter.append(new CollectionConverter(converter)); | |
converter.append(new CityToString()); | |
converter.append(new StringToCity()); | |
converter.append(new StreetToString()); |