org.jpatterns.gof.MediatorPattern Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jpatterns Show documentation
Show all versions of jpatterns Show documentation
Design Patterns are typically encoded into Java code in an ad-hoc fashion.
They are either embedded into the names of the classes or written into the
Javadocs.
Unfortunately it is impossible to accurately determine a pattern based
solely on the
class structure without knowing the intent of the code author.
JPatterns is a collection of annotations that make it easy to communicate
the use
of (Design)Patterns within your code to your fellow developers and your
future self.
The newest version!
package org.jpatterns.gof;
import org.jpatterns.core.*;
import java.lang.annotation.*;
/**
* Intent [GoF, pg 273]: Define an object that encapsulates how a set of
* objects interact. Mediator promotes loose coupling by keeping objects from
* referring to each other explicitly, and it lets you vary their interaction
* independently.
*
*
*
* @author Heinz Kabutz
* @since 2010-08-09
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@DesignPattern(type = Type.BEHAVIORAL,
related = {FacadePattern.class, ObserverPattern.class})
public @interface MediatorPattern {
Class[] participants() default {};
String comment() default "";
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface Mediator {
Class[] participants() default {};
String comment() default "";
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface Colleague {
Class[] participants() default {};
String comment() default "";
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface ConcreteMediator {
Class[] participants() default {};
String comment() default "";
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface ConcreteColleague {
Class[] participants() default {};
String comment() default "";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy