Class AnnotationDefaults

java.lang.Object
org.fastnate.generator.context.AnnotationDefaults
All Implemented Interfaces:
InvocationHandler

public class AnnotationDefaults extends Object implements InvocationHandler
Creates an implementation of an annotation class to access the default values for the single values.
Author:
Tobias Liefke
  • Field Details

  • Constructor Details

    • AnnotationDefaults

      public AnnotationDefaults(Map<String,Object> overrides)
  • Method Details

    • create

      public static <A extends Annotation> A create(Class<A> annotation)
      Creates a proxy class that returns the default value from the annotation for every method.
      Parameters:
      annotation - the annotation class
      Returns:
      the proxy class containing the default values
    • create

      public static <A extends Annotation> A create(Class<A> annotation, Map<String,Object> overrides)
      Creates a proxy class that returns the default value from the annotation for every method.
      Parameters:
      annotation - the annotation class
      overrides - the name methods that should return a value different from default
      Returns:
      the proxy class containing the default values
    • invoke

      public Object invoke(Object proxy, Method method, Object[] args)
      Finds the default value for the original method.
      Specified by:
      invoke in interface InvocationHandler