Last active
August 24, 2016 17:16
-
-
Save emil10001/6465436 to your computer and use it in GitHub Desktop.
BusProvider as enum
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 enum BusProvider { | |
INSTANCE; | |
public final Bus BUS; | |
private BusProvider() { | |
BUS = new Bus(); | |
} | |
} |
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
BusProvider.INSTANCE.BUS; | |
// or do something useful with it: | |
BusProvider.INSTANCE.BUS.post(someObj); |
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
MultiBusProvider.BUS_ONE.BUS; | |
MultiBusProvider.BUS_TWO.BUS; | |
// or do something useful with it: | |
MultiBusProvider.BUS_ONE.BUS.post(someObj); | |
MultiBusProvider.BUS_TWO.BUS.post(anotherObj); |
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 enum MultiBusProvider { | |
BUS_ONE, BUS_TWO; | |
public final Bus BUS; | |
private MultiBusProvider() { | |
BUS = new Bus(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment