Skip to content

plugback/active

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#Plugback Active - Active Annotations for the Xtend Java language Plugback Active contains a set of active annotations useful for everyday work.

##What do you need To use Plugback Active you need:

##Available annotations

Hook

Using the Hook active annotation any method can be intercepted before or after it is executed.

Place the @Hook(register=true) annotation everywhere you want the method to be intercepted.
This will generate two event classes: BeforeClassNameMethodName and AfterClassNameMethodName.
These two classes contain the parameters of the original method that can be manipulated before and after the methiod execution. The AfterClassNameMethodName type contains the returned object too.

You can use these two classes in any other class to intercept that method call:

  1. create a method with just one argument of type BeforeClassNameMethodName or AfterClassNameMethodName;
  2. annotate the method using the @Hook annotation;
  3. use the parameter of the method to manipulate the execution.

The following is an example taken from the unit test, where the methods into the Me class are intercepted into the You class:

package com.salvatoreromeo.x
import com.plugback.active.event.Hook

class Me{
	
	@Hook(register = true)
	def String myMethod(String ciao){
		println("ok")
	}
	
	@Hook(register = true)
	def void myMethod2(){
	}
	
}


class You{
	@Hook
	def String yourMethod(BeforeMeMyMethod b){
		println("ok")
	}
	
	@Hook
	def String yourMethod2(AfterMeMyMethod2 a){
		println("ok")
	}
	
	
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages