All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lombok.javac.handlers.HandleArtemisInjected Maven / Gradle / Ivy

The newest version!
package lombok.javac.handlers;


import java.util.List;

import lombok.ArtemisInjected;
import lombok.ast.Annotation;
import lombok.core.AnnotationValues;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.handlers.ast.JavacType;

import org.kohsuke.MetaInfServices;

import com.sun.tools.javac.tree.JCTree.JCAnnotation;

@MetaInfServices(JavacAnnotationHandler.class)
public class HandleArtemisInjected extends JavacAnnotationHandler
{
	@Override
	public void handle(final AnnotationValues annotation, final JCAnnotation source, final JavacNode annotationNode)
	{
		JavacType type = JavacType.typeOf(annotationNode, source);
		for (Annotation a : type.annotations())
		{
			// because all else is null... 
			if (a.toString().startsWith("@WovenByTheHuntress"))
				return;
		}
		
		List mappedComponentTypes = annotation.getActualExpressions("mappers");
		List systemTypes = annotation.getActualExpressions("systems");
		List managerTypes = annotation.getActualExpressions("managers");
		
		new JavacHandler(type, annotationNode)
				.handle(mappedComponentTypes, systemTypes, managerTypes)
				.injectInitialize()
				.rebuild();
	}
}