Skip to content

Instantly share code, notes, and snippets.

@patrykpoborca
Last active July 27, 2016 17:58
Show Gist options
  • Save patrykpoborca/6a83cc062d70bc311e4f to your computer and use it in GitHub Desktop.
Save patrykpoborca/6a83cc062d70bc311e4f to your computer and use it in GitHub Desktop.
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