Field.getDeclaredAnnotations
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using java.lang.reflect.Field.getDeclaredAnnotations (Showing top 20 results out of 1,494)

  • Common ways to obtain Field
private void myMethod () {
Field f =
  • Class clazz;String name;clazz.getDeclaredField(name)
  • Class clazz;String name;clazz.getField(name)
  • Object object;String name;object.getClass().getDeclaredField(name)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-loaded

public Annotation[] getDeclaredAnnotations() {
  return (Annotation[]) f_annotated.getDeclaredAnnotations();
}
origin: spring-projects/spring-loaded

public static Annotation[] callGetDeclaredAnnotations(Field thiz) {
  return thiz.getDeclaredAnnotations();
}
origin: org.springframework.boot/spring-boot

public Annotation[] getAnnotations() {
  try {
    return (this.field != null) ? this.field.getDeclaredAnnotations() : null;
  }
  catch (Exception ex) {
    return null;
  }
}
origin: kiegroup/optaplanner

@Override
public Annotation[] getDeclaredAnnotations() {
  return field.getDeclaredAnnotations();
}
origin: libgdx/libgdx

/** Returns an array of {@link Annotation} objects reflecting all annotations declared by this field,
 * or an empty array if there are none. Does not include inherited annotations. */
public Annotation[] getDeclaredAnnotations () {
  java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
  Annotation[] result = new Annotation[annotations.length];
  for (int i = 0; i < annotations.length; i++) {
    result[i] = new Annotation(annotations[i]);
  }
  return result;
}
origin: libgdx/libgdx

/** Returns an array of {@link Annotation} objects reflecting all annotations declared by this field,
 * or an empty array if there are none. Does not include inherited annotations. */
public Annotation[] getDeclaredAnnotations () {
  java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
  Annotation[] result = new Annotation[annotations.length];
  for (int i = 0; i < annotations.length; i++) {
    result[i] = new Annotation(annotations[i]);
  }
  return result;
}
origin: spring-projects/spring-loaded

public List<Annotation> callFieldGetDeclaredAnnotations(Field m) {
  return Arrays.asList(m.getDeclaredAnnotations());
}
public boolean callFieldIsAnnotationPresent(Field m, Class<? extends Annotation> annotClass) {
origin: stackoverflow.com

 for(Field field : cls.getDeclaredFields()){
 Class type = field.getType();
 String name = field.getName();
 Annotation[] annotations = field.getDeclaredAnnotations();
}
origin: libgdx/libgdx

/** Returns an {@link Annotation} object reflecting the annotation provided, or null of this field doesn't
 * have such an annotation. This is a convenience function if the caller knows already which annotation
 * type he's looking for. */
public Annotation getDeclaredAnnotation (Class<? extends java.lang.annotation.Annotation> annotationType) {
  java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
  if (annotations == null) {
    return null;
  }
  for (java.lang.annotation.Annotation annotation : annotations) {
    if (annotation.annotationType().equals(annotationType)) {
      return new Annotation(annotation);
    }
  }
  return null;
}
origin: libgdx/libgdx

/** Returns an {@link Annotation} object reflecting the annotation provided, or null of this field doesn't
 * have such an annotation. This is a convenience function if the caller knows already which annotation
 * type he's looking for. */
public Annotation getDeclaredAnnotation (Class<? extends java.lang.annotation.Annotation> annotationType) {
  java.lang.annotation.Annotation[] annotations = field.getDeclaredAnnotations();
  if (annotations == null) {
    return null;
  }
  for (java.lang.annotation.Annotation annotation : annotations) {
    if (annotation.annotationType().equals(annotationType)) {
      return new Annotation(annotation);
    }
  }
  return null;
}
origin: spockframework/spock

private static Set<Annotation> getQualifierAnnotations(Field field) {
 // Assume that any annotations other than @MockBean/@SpyBean are qualifiers
 Annotation[] candidates = field.getDeclaredAnnotations();
 Set<Annotation> annotations = new HashSet<>(candidates.length);
 for (Annotation candidate : candidates) {
  if (!isMockOrSpyAnnotation(candidate)) {
   annotations.add(candidate);
  }
 }
 return annotations;
}
origin: ronmamo/reflections

public List<String> getFieldAnnotationNames(Field field) {
  return getAnnotationNames(field.getDeclaredAnnotations());
}
origin: org.reflections/reflections

public List<String> getFieldAnnotationNames(Field field) {
  return getAnnotationNames(field.getDeclaredAnnotations());
}
origin: Alluxio/alluxio

 /**
  * @param name the name of a property key
  * @return if this property key is deprecated
  */
 public static boolean isDeprecated(String name) {
  try {
   PropertyKey key = new PropertyKey(name);
   Class c = key.getClass();
   Field field = c.getDeclaredField(name);
   Annotation[] annotations = field.getDeclaredAnnotations();
   for (Annotation anno : annotations) {
    if (anno instanceof Deprecated) {
     return true;
    }
   }
   return false;
  } catch (NoSuchFieldException e) {
   return false;
  }
 }
}
origin: redisson/redisson

/**
 * {@inheritDoc}
 */
@CachedReturnPlugin.Enhance("declaredAnnotations")
public AnnotationList getDeclaredAnnotations() {
  return new AnnotationList.ForLoadedAnnotations(field.getDeclaredAnnotations());
}
origin: prestodb/presto

/**
 * Method called to add field mix-ins from given mix-in class (and its fields)
 * into already collected actual fields (from introspected classes and their
 * super-classes)
 */
private void _addFieldMixIns(Class<?> mixInCls, Class<?> targetClass,
    Map<String,FieldBuilder> fields)
{
  List<Class<?>> parents = ClassUtil.findSuperClasses(mixInCls, targetClass, true);
  for (Class<?> mixin : parents) {
    for (Field mixinField : ClassUtil.getDeclaredFields(mixin)) {
      // there are some dummy things (static, synthetic); better ignore
      if (!_isIncludableField(mixinField)) {
        continue;
      }
      String name = mixinField.getName();
      // anything to mask? (if not, quietly ignore)
      FieldBuilder b = fields.get(name);
      if (b != null) {
        b.annotations = collectAnnotations(b.annotations, mixinField.getDeclaredAnnotations());
      }
    }
  }
}
origin: redisson/redisson

/**
 * Method called to add field mix-ins from given mix-in class (and its fields)
 * into already collected actual fields (from introspected classes and their
 * super-classes)
 */
private void _addFieldMixIns(Class<?> mixInCls, Class<?> targetClass,
    Map<String,FieldBuilder> fields)
{
  List<Class<?>> parents = ClassUtil.findSuperClasses(mixInCls, targetClass, true);
  for (Class<?> mixin : parents) {
    for (Field mixinField : ClassUtil.getDeclaredFields(mixin)) {
      // there are some dummy things (static, synthetic); better ignore
      if (!_isIncludableField(mixinField)) {
        continue;
      }
      String name = mixinField.getName();
      // anything to mask? (if not, quietly ignore)
      FieldBuilder b = fields.get(name);
      if (b != null) {
        b.annotations = collectAnnotations(b.annotations, mixinField.getDeclaredAnnotations());
      }
    }
  }
}
origin: h2oai/h2o-2

static FFilter Request2FFilter = new FFilter() { @Override boolean involve(Field f) { return contains(API.class, f.getDeclaredAnnotations()); } };
static boolean contains(Class<? extends Annotation> annoType, Annotation[] annotations) {
origin: dropwizard/dropwizard

/**
 * Gets a method parameter (or a parameter field) name, if the violation raised in it.
 */
private static Optional<String> getMemberName(ConstraintViolation<?> violation, Invocable invocable) {
  final List<Path.Node> propertyPath = Lists.of(violation.getPropertyPath());
  final int size = propertyPath.size();
  if (size < 2) {
    return Optional.empty();
  }
  final Path.Node parent = propertyPath.get(size - 2);
  final Path.Node member = propertyPath.get(size - 1);
  switch (parent.getKind()) {
    case PARAMETER:
      // Constraint violation most likely failed with a BeanParam
      final List<Parameter> parameters = invocable.getParameters();
      final Parameter param = parameters.get(parent.as(Path.ParameterNode.class).getParameterIndex());
      // Extract the failing *Param annotation inside the Bean Param
      if (param.getSource().equals(Parameter.Source.BEAN_PARAM)) {
        final Field field = FieldUtils.getField(param.getRawType(), member.getName(), true);
        return JerseyParameterNameProvider.getParameterNameFromAnnotations(field.getDeclaredAnnotations());
      }
      break;
    case METHOD:
      return Optional.of(member.getName());
    default:
      break;
  }
  return Optional.empty();
}
origin: org.codehaus.jackson/jackson-mapper-asl

protected AnnotatedField _constructField(Field f)
{
  if (_annotationIntrospector == null) { // when annotation processing is disabled
    return new AnnotatedField(f, _emptyAnnotationMap());
  }
  return new AnnotatedField(f, _collectRelevantAnnotations(f.getDeclaredAnnotations()));
}
java.lang.reflectFieldgetDeclaredAnnotations

Popular methods of Field

  • get
    Returns the value of the field in the specified object. This reproduces the effect of object.fieldNa
  • setAccessible
  • getName
  • set
    Sets the value of the field in the specified object to the value. This reproduces the effect of obje
  • getType
  • getModifiers
  • getAnnotation
  • getGenericType
    Returns the generic type of this field.
  • isAnnotationPresent
  • getDeclaringClass
  • isAccessible
  • getInt
  • isAccessible,
  • getInt,
  • setInt,
  • getAnnotations,
  • isSynthetic,
  • setBoolean,
  • getLong,
  • getBoolean,
  • toString

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • orElseThrow (Optional)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)