JPatterns

JPatterns is a collection of annotations describing the used design patterns in your Java source code. They make you classes more readable for fellow developers and of course yourself as well. Most of the GOF patterns and a few JEE patterns are already supported. Have a look at the following command object pattern example right from the sources at github:

@CommandPattern.Command(participants = CommandReceiver.class)
interface Command {
 void execute();
}

@CommandPattern.ConcreteCommand(comment = "This is our TestCommand")
public class TestCommand implements Command {
 private boolean ran;

 public void execute() {
 ran = true;
 }
}

@CommandPattern.Receiver(participants = Command.class)
public class CommandReceiver {
 public void receive(Command command) {
 command.execute();
 }
}

http://www.jpatterns.org/

Source code at http://github.com/jexp/jpatterns

Views All Time
1797
Views Today
1
Short URL for this post: https://blog.oio.de/UwAZn
This entry was posted in Java and Quality, Java Basics and tagged , . Bookmark the permalink.