Package javax.lang.model.element

Examples of javax.lang.model.element.AnnotationValue


            Map<String, AnnotationValue> valueMap,
            String name) {
        assert valueType != null;
        assert valueMap != null;
        assert name != null;
        AnnotationValue value = valueMap.get(name);
        if (value == null) {
            return null;
        }
        Object content = value.getValue();
        if (valueType.isInstance(content) == false) {
            return null;
        }
        return valueType.cast(content);
    }
View Full Code Here


    static List<? extends AnnotationValue> getList(
            Map<String, AnnotationValue> valueMap,
            String name) {
        assert valueMap != null;
        assert name != null;
        AnnotationValue value = valueMap.get(name);
        if (value == null) {
            return null;
        }
        Object content = value.getValue();
        if ((content instanceof List<?>) == false) {
            return null;
        }
        return (List<? extends AnnotationValue>) content;
    }
View Full Code Here

        assert annotation != null;
        Map<String, AnnotationValue> results = Maps.create();
        for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry
                : annotation.getElementValues().entrySet()) {
            ExecutableElement key = entry.getKey();
            AnnotationValue value = entry.getValue();
            results.put(key.getSimpleName().toString(), value);
        }
        return results;
    }
View Full Code Here

    List<Long> lineNumbers = null;
    if (rootLineNumberIterator == null) {
      lineNumbers = getLineNumbers(parent, annotation);
    }

    AnnotationValue lastAnnotationValue = null;
    for (AnnotationValue annotationValue :
         annotation.getElementValues().values()) {
      @SuppressWarnings("unchecked")
      List<? extends AnnotationValue> values =
          (List<? extends AnnotationValue>) annotationValue.getValue();
View Full Code Here

   
    // scan for UseSetter
    String setterMethod = null;
    AnnotationMirror setterMirror = ProcessorUtil.mirror(UseSetter.class, method);
    if (setterMirror != null) {
      AnnotationValue setter = readAnnotationField(setterMirror, "value");
      setterMethod = (setter != null)
          ? (String)setter.getValue()
          : method.getSimpleName().toString();
    }
   
    return new FactoryMethod(method, component, setterMethod);
  }
View Full Code Here

  private static List<AnnotationValue> readCRef(Element element) {
    AnnotationMirror cref = ProcessorUtil.mirror(Bind.class, element);
    if (cref == null)
      return Collections.emptyList();
   
    AnnotationValue components = readAnnotationField(cref, "value");
    return (List<AnnotationValue>)components.getValue();
  }
View Full Code Here

    return Collections.emptySet();
  }

  private Set<ConstraintCheckError> checkAnnotationValue(TypeElement element, AnnotationMirror annotation) {
    Set<ConstraintCheckError> errors = CollectionHelper.newHashSet();
    AnnotationValue value = annotationApiHelper.getAnnotationValue( annotation, "value" );
    TypeMirror valueType = (TypeMirror) value.getValue();
    TypeElement valueElement = (TypeElement) typeUtils.asElement( valueType );

    if ( valueElement.getKind().isInterface() || valueElement.getModifiers().contains( Modifier.ABSTRACT ) ) {
      errors.add(
          new ConstraintCheckError(
View Full Code Here

    return constraintMetaAnnotation;
  }

  private List<? extends AnnotationValue> getValidatorClassesFromConstraintMetaAnnotation(AnnotationMirror constraintMetaAnnotation) {

    AnnotationValue validatedBy = annotationApiHelper.getAnnotationValue( constraintMetaAnnotation, "validatedBy" );

    return validatedBy.accept(
        new SimpleAnnotationValueVisitor6<List<? extends AnnotationValue>, Void>() {

          @Override
          public List<? extends AnnotationValue> visitArray(List<? extends AnnotationValue> values, Void p) {
            return values;
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public void validate(ProcessingEnvironment procEnv,
      RoundEnvironment roundEnv, TypeElement annotationType,
      AnnotationMirror annotation, ExecutableElement e) {
    AnnotationValue expectedReturnType = AnnotationProcessingUtils
        .getAnnotationElementValue(procEnv, annotation,
            "expectedParameterTypes");
    AnnotationValue strictValue = AnnotationProcessingUtils
        .getAnnotationElementValue(procEnv, annotation, "strict");
    Boolean strict = (Boolean) strictValue.getValue();

    if (!matches(procEnv, strict, getElementTypeMirrors(e.getParameters()),
        getTypeMirrors((List<AnnotationValue>) expectedReturnType
            .getValue()))) {
      procEnv.getMessager().printMessage(
View Full Code Here

  @Override
  public void validate(ProcessingEnvironment procEnv,
      RoundEnvironment roundEnv, TypeElement annotationType,
      AnnotationMirror annotation, ExecutableElement annotationMember,
      Element e, Object value) {
    AnnotationValue scopeValue = AnnotationProcessingUtils
        .getAnnotationElementValue(procEnv, annotation, "scope");

    ConstraintScope scope = ConstraintScope.valueOf(scopeValue.getValue()
        .toString());
    Map<Element, Set<Element>> elements = new HashMap<Element, Set<Element>>();

    switch (scope) {
    case GLOBAL:
View Full Code Here

TOP

Related Classes of javax.lang.model.element.AnnotationValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.