package com.kurukurupapa.tryandroid.apt002;

import java.io.IOException;

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.PackageElement;
import javax.lang.model.util.Elements;
import javax.tools.JavaFileObject;

public class AptUtils {

	public static String getPackageName(Element element,
			ProcessingEnvironment processingEnv) {
		Elements elements = processingEnv.getElementUtils();
		PackageElement pe = elements.getPackageOf(element);
		return pe.getQualifiedName().toString();
	}

	public static JavaFileObject createSourceFile(String className,
			ProcessingEnvironment processingEnv) throws IOException {
		return processingEnv.getFiler().createSourceFile(className);
	}

}
