Suggested Pages

Saturday, January 7, 2017

Java Annotation

State.java

package it.boomerang.statemachine.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface State {
 
  int value();
  
  int timeout() default -1;
  
}

Transition.java

package it.boomerang.statemachine.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Transition {
 
  State from();
  
  State to();
  
}

Transitions.java

package it.boomerang.statemachine.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Transitions {
 
 Transition[] transitions();

}

StateConfiguration .java

package it.boomerang.statemachine.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public abstract @interface StateConfiguration {
 
  State initialState();
  
  Transitions transitions();
  
  boolean sameStateAllowed() default false;
  
}


No comments :

Post a Comment

Suggested Pages