Last active
December 17, 2015 15:59
-
-
Save stijnvanbael/5635378 to your computer and use it in GitHub Desktop.
Sealed class hieararchy "implementation"
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
public final class DefaultSealedServices extends SealedServices { | |
private FooService fooService; | |
private BarService barService; | |
// We don’t want the client to instantiate this class | |
DefaultSealedServices(FooService fooService, BarService barService) { | |
this.fooService = fooService; | |
this.barService = barService; | |
} | |
@Override | |
public FooService getFooService() { | |
return fooService; | |
} | |
@Override | |
public BarService getBarService() { | |
return barService; | |
} | |
@Override | |
void validate() { | |
Validate.notNull(this.fooService); | |
Validate.notNull(this.barService); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment