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

net.stickycode.metadata.MetadataResolverRegistry Maven / Gradle / Ivy

There is a newer version: 3.3
Show newest version
package net.stickycode.metadata;

import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

import net.stickycode.stereotype.StickyFramework;

/**
 * 
 * 
 * Inject
 * MetadataResolverRegisty usingMetadata;
 * 
 * ...
 * 
 * Field field = findField();
 * if (withMetadata.is(field).metaAnnotatedWith(Configured.class)
 *   doSomethingWithAnnotatedField(field);
 *   
 * ...
 * 
 * Method method = fieldMethod();
 * if (usingMetadata.is(method).metaAnnotatedWith(Scheduled.class)
 *   doSomethingWithAnnotatedMethod(method);
 * 
 * ...
 * 
 * Class type = findType();
 * if (usingMetadata.is(type).annotatedWith(StickRepository.class)
 *   doSomethingWithAnnoatedType(type);
 *   
 * ...
 * 
 * Class type = findType();
 * if (usingMetadata.does(type).haveAnyFieldsAnnotatedWith(Configured.class, ConfiguredStrategy.class)
 *   doSomethingWithTypeWithAnnotedElements();
 *   
 * ...
 * 
 * Class type = findType();
 * if (usingMetadata.does(type).haveAnyMethodsAnnotatedWith(Scheduled.class, Pulse.class)
 *   doSomethingWithTypeWithAnnotedElements();
 * 
*/ @StickyFramework public interface MetadataResolverRegistry { /** * return a resolver for the given method that can resolve annotations on *
    *
  1. the method itself
  2. *
  3. annotations on the method
  4. *
*/ MetadataResolver is(Method method); /** * return a resolver for the given field that can resolve annotations on *
    *
  1. the field itself
  2. *
  3. annotations on the field
  4. *
*/ MetadataResolver is(Field field); /** * return a resolver for the given class that can resolve annotations on *
    *
  1. the type itself
  2. *
  3. interfaces of the type
  4. *
  5. any of the supertypes
  6. *
  7. any of the interfaces of the super types
  8. *
*/ MetadataResolver is(Class annotatedClass); /** * return a resolver for the given class that can resolve annotations on *
    *
  1. methods or fields of the type itself
  2. *
  3. methods or fileds of the interfaces of the type
  4. *
  5. methods or fields of any of the supertypes
  6. *
  7. methods or fields of any of the interfaces of the super types
  8. *
*/ ElementMetadataResolver does(Class type); /** * return a resolver for the given annotation element that can resolve annotations on *
    *
  1. the element itself
  2. *
  3. any of the super elements
  4. *
*/ MetadataResolver is(AnnotatedElement annotatedElement); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy