Skip to content

Instantly share code, notes, and snippets.

@bjpeterdelacruz
Created February 18, 2014 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjpeterdelacruz/9066602 to your computer and use it in GitHub Desktop.
Save bjpeterdelacruz/9066602 to your computer and use it in GitHub Desktop.
An example service
public class ExampleClientService implements ExampleListener {
private final List<ExampleListener> listeners = new ArrayList<ExampleListener>();
private final List<Example> examples = new ArrayList<Example>();
public void addExampleListener(ExampleListener listener) {
listeners.add(listener);
}
public void removeExampleListener(ExampleListener listener) {
listeners.remove(listener);
}
/** {@inheritDoc} */
@Override
public void goodExampleDispatched(Example example) {
copyExample(example);
}
/** {@inheritDoc} */
@Override
public void badExampleDispatched(Example example) {
copyExample(Example);
}
private void copyExample(Example example) {
// Copy Example into list and then send list to all listeners.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment