Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissilb committed Oct 21, 2023
1 parent e2e1e72 commit 88e1271
Show file tree
Hide file tree
Showing 50 changed files with 711 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,27 @@
/**
* Indicates that a method is called after a certain time span.
*
* @see Rule
* @see de.gwasch.code.escframework.events.patterns.Rule
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(AfterList.class)
@Rule
public @interface After {
int interval();
String methodName();

/**
* Returns the time interval to delay the method invocation.
*
* @return the time interval in milliseconds
*/
int interval();

/**
* Returns the name of the method which is invoked after the time interval
* elapsed. The referenced method must have to following signature:
* {@code public void <<methodName>>()}.
*
* @return the method name
*/
String methodName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

/**
* Enables <a href="https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html">
* Repeating Annotation</a>of {@link After}.
* Repeating Annotations</a> of {@link After}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AfterList {

/**
* Returns an array of single {@code After} annotations.
* @return array of single {@code After} annotations
*/
After[] value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,30 @@

import de.gwasch.code.escframework.components.utils.AsteriskType;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
/**
* Indicates that a method is called after as a placeholder method according to
* its {@link AsteriskType}.
* <p>
* An asterisk method have one of the following signature templates:
* <ul>
* <li>Simple: {@code public void <<<methodName>>()}</li>
* <li>Parameterized:
* {@code public void <<methodName>>(Object, Method, Object[])}</li>
* <li>Qualified:
* {@code public Object <<methodName>>(Object, Method, Object[])}</li>
* </ul>
* INSTEAD methods ({@code AsteriskType.ALL_INSTEAD},
* {@code AsteriskType.ELSE_INSTEAD} must have a qualified signature. Methods
* with another {@code AsteriskType} must have a simple or parameterized
* signature because they are call "in addition".
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Asterisk {
AsteriskType type() default AsteriskType.AFTER_ELSE;

/**
* Returns the asterisk type.
* @return the asterisk type
*/
AsteriskType type() default AsteriskType.AFTER_ELSE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@

/**
* Indicates that the annotated method is called after a certain time span.
* <p>
* The annotated method must have to following signature:
* {@code public void <<methodName>>()}.
*
* @see Rule
* @see de.gwasch.code.escframework.events.patterns.Rule
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(DelayList.class)
@Rule
public @interface Delay {
int interval();

/**
* Returns the time interval to delay the method invocation.
*
* @return the time interval in milliseconds
*/
int interval();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

/**
* Enables <a href="https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html">
* Repeating Annotation</a>of {@link Delay}.
* Repeating Annotations</a> of {@link Delay}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface DelayList {

/**
* Returns an array of single {@code Delay} annotations.
* @return array of single {@code Delay} annotations
*/
Delay[] value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,37 @@
import java.lang.annotation.Target;

/**
* Indicates that a method is called if the annotated method gets less {@link #invocations()}
* within the time span {@link #interval()}.
* Indicates that a method is called if the annotated method gets less
* {@link #invocations()} within a certain time span ({@link #interval()}).
*
* @see Rule
* @see de.gwasch.code.escframework.events.patterns.Rule
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(LessList.class)
@Rule
public @interface Less {
int interval();

/**
* Returns the considered time interval.
*
* @return the time interval in milliseconds
*/
int interval();

/**
* Returns the number of considered invocations.
*
* @return the number of considered invocations
*/
int invocations();

/**
* Returns the name of the method which is invoked after the time interval
* elapsed if less method invocations occurred. The referenced method must have
* to following signature: {@code public void <<methodName>>()}.
*
* @return the method name
*/
String methodName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

/**
* Enables <a href="https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html">
* Repeating Annotation</a>of {@link Less}.
* Repeating Annotations</a> of {@link Less}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LessList {

/**
* Returns an array of single {@code Less} annotations.
* @return array of single {@code Less} annotations
*/
Less[] value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,37 @@
import java.lang.annotation.Target;

/**
* Indicates that a method is called if the annotated method gets more {@link #invocations()}
* within the time span {@link #interval()}.
* Indicates that a method is called if the annotated method gets more
* {@link #invocations()} within a certain time span ({@link #interval()}).
*
* @see Rule
* @see de.gwasch.code.escframework.events.patterns.Rule
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(MoreList.class)
@Rule
public @interface More {
int interval();

/**
* Returns the considered time interval.
*
* @return the time interval in milliseconds
*/
int interval();

/**
* Returns the number of considered invocations.
*
* @return the number of considered invocations
*/
int invocations();
String methodName();

/**
* Returns the name of the method which is invoked once more invocations
* occurred with the defined time interval. The referenced method must have to
* following signature: {@code public void <<methodName>>()}.
*
* @return the method name
*/
String methodName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MoreList {

/**
* Returns an array of single {@code More} annotations.
* @return array of single {@code More} annotations
*/
More[] value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

/**
* Enables <a href="https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html">
* Repeating Annotation</a>of {@link PatternControlMethod}.
* Repeating Annotations</a> of {@link PatternControlMethod}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface PatternControlMethodList {

/**
* Returns an array of single {@code PatternControlMethod} annotations.
* @return array of single {@code PatternControlMethod} annotations
*/
PatternControlMethod[] value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,107 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import de.gwasch.code.escframework.components.utils.CodeGenerator;
import de.gwasch.code.escframework.events.patterns.PatternMatcher;

/**
* Enables cyclic invocations of the annotated method.
*
* @see de.gwasch.code.escframework.events.patterns.Rule
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(TickList.class)
@Rule
public @interface Tick {
int interval() default 1000;

/**
* Returns the time interval until the next method invocation happens.
*
* @return the time interval in milliseconds
*/
int interval() default 1000;

/**
* Returns the maximal deviation factor to adjust the interval to a random value
* within a certain borders. For example, if interval is set to 1000 and
* maxDeviationFactor is set to 0.1 the actual interval is a random number
* between 900 and 1100 (exclusive).
*
* @return the maximal deviation factor
*/
double maxDeviationFactor() default 0.0;

/**
* Returns the number of invocations of the tick method; a negative number means
* infinite.
*
* @return the number of invocations; a negative number means infinite
*/
int invocations() default -1;
@Generate String activateMethod() default "";
@Generate String deactivateMethod() default "";
@Generate String suspendMethod() default "";
@Generate String resumeMethod() default "";

/**
* Returns the name of the method which activates ticking. The method <b>must
* not</b> be define in the class. Instead it is generated into the component
* interface in the following format: {@code void <<<activateMethod>>()}. There
* is no implementation of such a method. Instead a corresponding invocation is
* consumed by the {@link PatternMatcher}. This code generation is provided by
* {@link CodeGenerator}. It can be trigger via the Maven plugin
* <a href="https://github.com/chrissilb/escifgen">escifgen</a>.
* <a href="https://github.com/chrissilb/demolibrary/blob/main/pom.xml">Here</a>
* you can find an example for its usage.
*
* @return the activate method name
*/
@Generate
String activateMethod() default "";

/**
* Returns the name of the method which deactivates ticking. The method <b>must
* not</b> be define in the class. Instead it is generated into the component
* interface in the following format: {@code void <<<deactivateMethod>>()}.
* There is no implementation of such a method. Instead a corresponding
* invocation is consumed by the {@link PatternMatcher}. This code generation is
* provided by {@link CodeGenerator}. It can be trigger via the Maven plugin
* <a href="https://github.com/chrissilb/escifgen">escifgen</a>.
* <a href="https://github.com/chrissilb/demolibrary/blob/main/pom.xml">Here</a>
* you can find an example for its usage.
*
* @return the deactivate method name
*/
@Generate
String deactivateMethod() default "";

/**
* Returns the name of the method which suspends ticking. The method <b>must
* not</b> be define in the class. Instead it is generated into the component
* interface in the following format: {@code void <<<suspendMethod>>()}. There
* is no implementation of such a method. Instead a corresponding invocation is
* consumed by the {@link PatternMatcher}. This code generation is provided by
* {@link CodeGenerator}. It can be trigger via the Maven plugin
* <a href="https://github.com/chrissilb/escifgen">escifgen</a>.
* <a href="https://github.com/chrissilb/demolibrary/blob/main/pom.xml">Here</a>
* you can find an example for its usage.
*
* @return the suspend method name
*/
@Generate
String suspendMethod() default "";

/**
* Returns the name of the method which resumes ticking after it was suspended.
* The method <b>must not</b> be define in the class. Instead it is generated
* into the component interface in the following format:
* {@code void <<<resumeMethod>>()}. There is no implementation of such a
* method. Instead a corresponding invocation is consumed by the
* {@link PatternMatcher}. This code generation is provided by
* {@link CodeGenerator}. It can be trigger via the Maven plugin
* <a href="https://github.com/chrissilb/escifgen">escifgen</a>.
* <a href="https://github.com/chrissilb/demolibrary/blob/main/pom.xml">Here</a>
* you can find an example for its usage.
*
* @return the resume method name
*/
@Generate
String resumeMethod() default "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@

/**
* Enables <a href="https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html">
* Repeating Annotation</a>of {@link Tick}.
* Repeating Annotations</a> of {@link Tick}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface TickList {

/**
* Returns an array of single {@code Tick} annotations.
* @return array of single {@code Tick} annotations
*/
Tick[] value();
}
Loading

0 comments on commit 88e1271

Please sign in to comment.