Last active
August 6, 2018 11:56
-
-
Save freaksgit/478a51f0ae4a919d94ef7593418a5d22 to your computer and use it in GitHub Desktop.
This file contains 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 A extends Parent implements AContract.View{ | |
@Named(DiNames.SOME_DEPENDENCY_FOR_A) | |
@Inject | |
SomeDependency dependency; | |
@Inject | |
AContract.Presenter presenter; | |
public A(Data data){ | |
inject(this); | |
createFromData(data); | |
} | |
} |
This file contains 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 AbcFactory{ | |
public static Parent createParent(Data data){ | |
switch(data.getType()){ | |
case Type.A:return new A(data); | |
case Type.B:return new B(data); | |
case Type.C: throw new UnsupportedOperationException("Not implemented for data type: " + data.getType()); | |
default: throw new IllegalArgumentException("Unsupported data type: " + data.getType()); | |
} | |
} |
This file contains 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 B extends Parent implements BContract.View{ | |
@Named(DiNames.SOME_DEPENDENCY_FOR_B) | |
@Inject | |
SomeDependency dependency; | |
@Inject | |
BContract.Presenter presenter; | |
public B(Data data){ | |
inject(this); | |
createFromData(data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment