package net.q2ek.compileinfo;

import static java.lang.annotation.RetentionPolicy.CLASS;

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

/**
 * Annotate a class to generate {@code <AnnotatedClassNamex>CompileInfo.java}
 * <br/>
 *
 * Example: <br/>
 *
 * <pre>
 * <code>
 * {@literal @}CompileInfo
 * class MyClass {
 * 	public String compileTime() {
 * 		return MyClassCompileInfo.zonedDateTime().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
 * 	}
 *
 * 	public String jenkinsBuildUrl() {
 * 		return MyClassCompileInfo.properties().get("env.BUILD_URL");
 * 	}
 * }
 * </code>
 * </pre>
 *
 * @author Edze Kruizinga
 */
@Retention(CLASS)
@Target(ElementType.TYPE)
public @interface CompileInfo {
	/**
	 * This will be used as the format string for the generated classname
	 * instead of "%sCompileInfo"
	 */
	String classname() default "%sCompileInfo";

	/**
	 * If set to false no system properties will be read and the generated class
	 * will not contain a map of system properties.
	 */
	boolean includeSystemProperties() default true;

	/**
	 * System properties will be filtered using this regex.
	 */
	String regex() default ".*";
}

@@ -28,67 +28,8 @@
 o;%0A%0A
-import static java.lang.annotation.RetentionPolicy.CLASS;%0A%0A
 impo
@@ -104,16 +104,61 @@
 ention;%0A
+import java.lang.annotation.RetentionPolicy;%0A
 import j
@@ -687,13 +687,30 @@
 ion(
-CLASS
+RetentionPolicy.SOURCE
 )%0A@T

Use RetentionPolicy.SOURCE