org.ektorp.util
Class ReflectionUtils

java.lang.Object
  extended by org.ektorp.util.ReflectionUtils

public class ReflectionUtils
extends java.lang.Object


Nested Class Summary
static interface ReflectionUtils.AnnotationPredicate
           
 
Constructor Summary
ReflectionUtils()
           
 
Method Summary
static void eachAnnotatedMethod(java.lang.Class<?> clazz, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, Predicate<java.lang.reflect.Method> p)
           
static
<T extends java.lang.annotation.Annotation>
void
eachAnnotation(java.lang.Class<?> clazz, java.lang.Class<T> annotationClass, Predicate<T> p)
           
static java.util.List<java.lang.reflect.Method> findAnnotatedMethods(java.lang.Class<?> clazz, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
           
static java.lang.reflect.Method findMethod(java.lang.Class<?> clazz, java.lang.String name)
          Ignores case when comparing method names
static java.lang.String getId(java.lang.Object document)
           
static java.lang.String getRevision(java.lang.Object document)
           
static boolean isNew(java.lang.Object document)
           
static void setId(java.lang.Object document, java.lang.String id)
          Will set the id property on the document IF a mutator exists.
static void setRevision(java.lang.Object document, java.lang.String rev)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getId

public static java.lang.String getId(java.lang.Object document)

setId

public static void setId(java.lang.Object document,
                         java.lang.String id)
Will set the id property on the document IF a mutator exists. Otherwise nothing happens.

Parameters:
document -
id -

getRevision

public static java.lang.String getRevision(java.lang.Object document)

setRevision

public static void setRevision(java.lang.Object document,
                               java.lang.String rev)

isNew

public static boolean isNew(java.lang.Object document)

eachAnnotatedMethod

public static void eachAnnotatedMethod(java.lang.Class<?> clazz,
                                       java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
                                       Predicate<java.lang.reflect.Method> p)

eachAnnotation

public static <T extends java.lang.annotation.Annotation> void eachAnnotation(java.lang.Class<?> clazz,
                                                                              java.lang.Class<T> annotationClass,
                                                                              Predicate<T> p)

findAnnotatedMethods

public static java.util.List<java.lang.reflect.Method> findAnnotatedMethods(java.lang.Class<?> clazz,
                                                                            java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)

findMethod

public static java.lang.reflect.Method findMethod(java.lang.Class<?> clazz,
                                                  java.lang.String name)
Ignores case when comparing method names

Parameters:
clazz -
name -
Returns:


Copyright © 2010. All Rights Reserved.