Example usage for org.springframework.data.util ReflectionUtils findField

List of usage examples for org.springframework.data.util ReflectionUtils findField

Introduction

In this page you can find the example usage for org.springframework.data.util ReflectionUtils findField.

Prototype

@Nullable
public static Field findField(Class<?> type, DescribedFieldFilter filter) 

Source Link

Document

Finds the field matching the given DescribedFieldFilter .

Usage

From source file:org.zalando.spring.data.businesskey.config.AnnotationBusinessKeyMetadata.java

private AnnotationBusinessKeyMetadata(final Class<?> type) {

    Assert.notNull(type, "Given Type must not be null");
    businessKeyField = ReflectionUtils.findField(type, BUSINESSKEY_FILTER);
}

From source file:ei.ne.ke.cassandra.cql3.EntitySpecificationUtils.java

/**
 * @param entityClazz//from   www  . jav a2 s . c om
 * @return the value of the {@link java.reflect.Field} annotated with
 * {@link javax.persistence.Id}.
 */
public static <T, ID extends Serializable> Field findPrimaryKeyField(Class<T> entityClazz) {
    Preconditions.checkNotNull(entityClazz);
    Field f = ReflectionUtils.findField(entityClazz, new AnnotationFieldFilter(Id.class));
    if (f != null && !f.isAccessible()) {
        f.setAccessible(true);
    }
    return f;
}

From source file:ei.ne.ke.cassandra.cql3.EntitySpecificationUtils.java

/**
 * @param entityClazz//w w w .j  a  v  a2  s  .c om
 * @return the value of the {@link java.reflect.Field} annotated with
 * {@link javax.persistence.EmbeddedId}.
 */
public static <T, ID extends Serializable> Field findCompoundKeyField(Class<T> entityClazz) {
    Preconditions.checkNotNull(entityClazz);
    Field f = ReflectionUtils.findField(entityClazz, new AnnotationFieldFilter(EmbeddedId.class));
    if (f != null && !f.isAccessible()) {
        f.setAccessible(true);
    }
    return f;
}