mirror of https://github.com/sbt/sbt.git
make serializable abstract Lazy template
This commit is contained in:
parent
4a0461c34f
commit
d85f438035
|
|
@ -0,0 +1,26 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2010 Mark Harrah
|
||||
*/
|
||||
package xsbti.api;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
|
||||
public abstract class AbstractLazy<T> implements Lazy<T>, java.io.Serializable
|
||||
{
|
||||
private Object writeReplace() throws ObjectStreamException
|
||||
{
|
||||
return new StrictLazy<T>(get());
|
||||
}
|
||||
private static final class StrictLazy<T> implements Lazy<T>, java.io.Serializable
|
||||
{
|
||||
private final T value;
|
||||
StrictLazy(T t)
|
||||
{
|
||||
value = t;
|
||||
}
|
||||
public T get()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009 Mark Harrah
|
||||
* Copyright 2010 Mark Harrah
|
||||
*/
|
||||
package xsbti.api;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue