Last active
July 27, 2016 17:58
-
-
Save patrykpoborca/6a83cc062d70bc311e4f to your computer and use it in GitHub Desktop.
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 DependencyFactory{ | |
private static MyDependency myDependency; | |
private static MyClass myClass; | |
public static MyDependency providesMyDependency(){ | |
if(myDependency == null){ | |
myDependency = new MyDependency(); | |
} | |
return myDependency; | |
} | |
public static MyClass providesMyClass(){ | |
if(myClass == null){ | |
myClass = new MyClass(providesMyDependency()) | |
} | |
return myClass; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment