javax.lang.model.element.ExecutableElement#getAnnotation ( )源码实例Demo

下面列出了javax.lang.model.element.ExecutableElement#getAnnotation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u60   文件: WebServiceVisitor.java
protected boolean hasWebMethods(TypeElement element) {
    if (element.getQualifiedName().toString().equals(Object.class.getName()))
        return false;
    WebMethod webMethod;
    for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) {
        webMethod = method.getAnnotation(WebMethod.class);
        if (webMethod != null) {
            if (webMethod.exclude()) {
                if (webMethod.operationName().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "operationName", element.getQualifiedName(), method.toString()), method);
                if (webMethod.action().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "action", element.getQualifiedName(), method.toString()), method);
            } else {
                return true;
            }
        }
    }
    return false;//hasWebMethods(d.getSuperclass().getDeclaration());
}
 
源代码2 项目: openjdk-8-source   文件: WebServiceVisitor.java
protected boolean hasWebMethods(TypeElement element) {
    if (element.getQualifiedName().toString().equals(Object.class.getName()))
        return false;
    WebMethod webMethod;
    for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) {
        webMethod = method.getAnnotation(WebMethod.class);
        if (webMethod != null) {
            if (webMethod.exclude()) {
                if (webMethod.operationName().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "operationName", element.getQualifiedName(), method.toString()), method);
                if (webMethod.action().length() > 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE(
                            "action", element.getQualifiedName(), method.toString()), method);
            } else {
                return true;
            }
        }
    }
    return false;//hasWebMethods(d.getSuperclass().getDeclaration());
}
 
源代码3 项目: RetroFacebook   文件: RetroFacebookProcessor.java
public String buildBody(ExecutableElement method) {
  String body = "";

  // TODO duplicated routine
  retrofacebook.RetroFacebook.POST post = method.getAnnotation(retrofacebook.RetroFacebook.POST.class);
  if (post == null) return body;

  // TODO duplicated code
  List<? extends VariableElement> parameters = method.getParameters();
  for (VariableElement parameter : parameters) {
    if (parameter.getAnnotation(retrofacebook.RetroFacebook.Body.class) != null) {
      body = parameter.getSimpleName().toString();
    }
  }
  return body;
}
 
源代码4 项目: SimpleWeibo   文件: RetroWeiboProcessor.java
public String buildPath(ExecutableElement method) {
  // TODO duplicated routine
  retroweibo.RetroWeibo.GET get = method.getAnnotation(retroweibo.RetroWeibo.GET.class);
  retroweibo.RetroWeibo.POST post = method.getAnnotation(retroweibo.RetroWeibo.POST.class);
  retroweibo.RetroWeibo.DELETE delete = method.getAnnotation(retroweibo.RetroWeibo.DELETE.class);
  String fullPath = null;
  if (get != null) fullPath = get.value();
  if (post != null) fullPath = post.value();
  if (delete != null) fullPath = delete.value();

  List<? extends VariableElement> parameters = method.getParameters();
  for (VariableElement parameter : parameters) {
    retroweibo.RetroWeibo.Path path = parameter
        .getAnnotation(retroweibo.RetroWeibo.Path.class);
    if ((path != null) && (!path.value().equals("null"))) {
      fullPath = fullPath.replace("{" + path.value() + "}", "\" + " +
          parameter.getSimpleName().toString() + " + \"");
    } else {
      fullPath = fullPath.replace("{" + parameter.getSimpleName().toString() + "}", "\" + " +
          parameter.getSimpleName().toString() + " + \"");
    }
  }

  return "\"" + fullPath.replaceAll("\\?.+", "") + "\"";
}
 
源代码5 项目: pocketknife   文件: BuilderProcessor.java
private IntentMethodBinding getIntentMethodBinding(ExecutableElement element) throws InvalidTypeException {
    IntentBuilder intentBuilder = element.getAnnotation(IntentBuilder.class);
    String intentBuilderName = IntentBuilder.class.getName();
    String action = null;
    if (!isDefaultAnnotationElement(element, intentBuilderName, "action")) {
        action = intentBuilder.action();
    }
    Element dataParam = getIntentData(element);
    String dataParamName = null;
    if (dataParam != null) {
        dataParamName = dataParam.getSimpleName().toString();
    }
    boolean dataParamIsString = dataParam != null && types.isAssignable(dataParam.asType(), typeUtil.stringType);
    Integer flags = null;
    if (!isDefaultAnnotationElement(element, intentBuilderName, "flags")) {
        flags = intentBuilder.flags();
    }
    String type = null;
    if (!isDefaultAnnotationElement(element, intentBuilderName, "type")) {
        type = intentBuilder.type();
    }

    IntentMethodBinding binding = new IntentMethodBinding(element.getSimpleName().toString(), getIntentBuilderClsValue(element), action,
            dataParamName, flags, intentBuilder.categories(), type, dataParamIsString);
    for (Element parameter : element.getParameters()) {
        binding.addField(getIntentFieldBinding(parameter));
    }
    return binding;
}
 
源代码6 项目: litho   文件: MethodExtractorUtils.java
private static boolean canCreateDiffModels(
    ExecutableElement method,
    List<Class<? extends Annotation>> delegateMethodAnnotationsThatSkipDiffModels) {

  for (Class<? extends Annotation> delegate : delegateMethodAnnotationsThatSkipDiffModels) {
    if (method.getAnnotation(delegate) != null) {
      return false;
    }
  }

  return true;
}
 
源代码7 项目: SensorAnnotations   文件: AnnotatedMethod.java
AnnotatedMethod(@NonNull ExecutableElement methodElement,
    @NonNull Class<? extends Annotation> annotationClass) throws IllegalArgumentException {
    Annotation annotation = methodElement.getAnnotation(annotationClass);
    mAnnotatedMethodElement = methodElement;
    mDelay = getDelayFromAnnotation(annotation);
    mSensorType = getSensorTypeFromAnnotation(annotation);

    if (mSensorType == INVALID_SENSOR) {
        throw new IllegalArgumentException(String.format(
            "No sensor type specified in @%s for method %s."
                + " Set a sensor type such as Sensor.TYPE_ACCELEROMETER.",
            annotationClass.getSimpleName(), methodElement.getSimpleName().toString()));
    }
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: WebServiceVisitor.java
@Override
public Void visitExecutable(ExecutableElement method, Object o) {
    // Methods must be public
    if (!method.getModifiers().contains(Modifier.PUBLIC))
        return null;
    if (processedMethod(method))
        return null;
    WebMethod webMethod = method.getAnnotation(WebMethod.class);
    if (webMethod != null && webMethod.exclude())
        return null;
    SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class);
    if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) {
        if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) {
            soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class);
            if (soapBinding != null)
                builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding.");
            else {
                soapBinding = new MySoapBinding();
            }
        }
    }
    boolean newBinding = false;
    if (soapBinding != null) {
        newBinding = pushSoapBinding(soapBinding, method, typeElement);
    }
    try {
        if (shouldProcessMethod(method, webMethod)) {
            processMethod(method, webMethod);
        }
    } finally {
        if (newBinding) {
            popSoapBinding();
        }
    }
    return null;
}
 
源代码9 项目: reductor   文件: AutoReducerInit.java
public static AutoReducerInit parse(Env env, ExecutableElement executableElement, TypeMirror stateType) throws ValidationException {
    if (executableElement.getAnnotation(AutoReducer.Action.class) != null) {
        throw new ValidationException(executableElement, "Method %s should be may be annotated" +
                " with either @AutoReducer.InitialState or @AutoReducer.Action but not both", executableElement);
    }

    ValidationUtils.validateReturnsState(env, stateType, executableElement);
    ValidationUtils.validateIsNotPrivate(executableElement);

    int paramsCount = executableElement.getParameters().size();
    if (paramsCount != 0) {
        throw new ValidationException(executableElement, "Method %s should not have any parameters", executableElement);
    }
    return new AutoReducerInit(executableElement);
}
 
源代码10 项目: dagger2-sample   文件: Key.java
Key forProvidesMethod(ExecutableType executableType, ExecutableElement e) {
  checkNotNull(e);
  checkArgument(e.getKind().equals(METHOD));
  Provides providesAnnotation = e.getAnnotation(Provides.class);
  checkArgument(providesAnnotation != null);
  TypeMirror returnType = normalize(types, executableType.getReturnType());
  switch (providesAnnotation.type()) {
    case UNIQUE:
      return new AutoValue_Key(
          wrapOptionalInEquivalence(AnnotationMirrors.equivalence(), getQualifier(e)),
          MoreTypes.equivalence().wrap(returnType));
    case SET:
      TypeMirror setType = types.getDeclaredType(getSetElement(), returnType);
      return new AutoValue_Key(
          wrapOptionalInEquivalence(AnnotationMirrors.equivalence(), getQualifier(e)),
          MoreTypes.equivalence().wrap(setType));
    case MAP:
      AnnotationMirror mapKeyAnnotation = Iterables.getOnlyElement(getMapKeys(e));
      MapKey mapKey =
          mapKeyAnnotation.getAnnotationType().asElement().getAnnotation(MapKey.class);
      TypeElement keyTypeElement =
          mapKey.unwrapValue() ? Util.getKeyTypeElement(mapKeyAnnotation, elements)
              : (TypeElement) mapKeyAnnotation.getAnnotationType().asElement();
      TypeMirror valueType = types.getDeclaredType(getProviderElement(), returnType);
      TypeMirror mapType =
          types.getDeclaredType(getMapElement(), keyTypeElement.asType(), valueType);
      return new AutoValue_Key(
          wrapOptionalInEquivalence(AnnotationMirrors.equivalence(), getQualifier(e)),
          MoreTypes.equivalence().wrap(mapType));
    case SET_VALUES:
      // TODO(gak): do we want to allow people to use "covariant return" here?
      checkArgument(returnType.getKind().equals(DECLARED));
      checkArgument(((DeclaredType) returnType).asElement().equals(getSetElement()));
      return new AutoValue_Key(
          wrapOptionalInEquivalence(AnnotationMirrors.equivalence(), getQualifier(e)),
          MoreTypes.equivalence().wrap(returnType));
    default:
      throw new AssertionError();
  }
}
 
源代码11 项目: netbeans   文件: ClassStructure.java
@Hint(displayName = "#DN_org.netbeans.modules.java.hints.ClassStructure.finalMethodInFinalClass", description = "#DESC_org.netbeans.modules.java.hints.ClassStructure.finalMethodInFinalClass", category = "class_structure", enabled = false, suppressWarnings = {"FinalMethodInFinalClass"}) //NOI18N
@TriggerTreeKind(Kind.METHOD)
public static ErrorDescription finalMethodInFinalClass(HintContext context) {
    final MethodTree mth = (MethodTree) context.getPath().getLeaf();
    final Tree parent = context.getPath().getParentPath().getLeaf();
    if (TreeUtilities.CLASS_TREE_KINDS.contains(parent.getKind()) && mth.getModifiers().getFlags().contains(Modifier.FINAL) && ((ClassTree) parent).getModifiers().getFlags().contains(Modifier.FINAL)) {
        // see defect #236974; although redundant, if the method is annotated with @SafeVarargs, we must permit final modifier.
        ExecutableElement ee = (ExecutableElement)context.getInfo().getTrees().getElement(context.getPath());
        if (ee == null || ee.getAnnotation(SafeVarargs.class) == null) {
            return ErrorDescriptionFactory.forName(context, mth, NbBundle.getMessage(ClassStructure.class, "MSG_FinalMethodInFinalClass", mth.getName()), //NOI18N
                    FixFactory.removeModifiersFix(context.getInfo(), TreePath.getPath(context.getPath(), mth.getModifiers()), EnumSet.of(Modifier.FINAL), NbBundle.getMessage(ClassStructure.class, "FIX_RemoveFinalFromMethod", mth.getName()))); //NOI18N
        }
    }
    return null;
}
 
源代码12 项目: java   文件: OperatorProcessor.java
private void collectOpMethods(
    Multimap<String, MethodSpec> groupedMethods, TypeElement opClass, TypeElement annotation) {
  boolean opClassDeprecated = opClass.getAnnotation(Deprecated.class) != null;
  AnnotationMirror operatorAnnot = getAnnotationMirror(opClass, annotation.getQualifiedName());
  if (operatorAnnot == null) {
    throw new IllegalArgumentException(
        "Annotation "
            + annotation.getSimpleName()
            + " not present on element "
            + opClass.getSimpleName());
  }
  String opGroup = getAnnotationElementValueAsString("group", operatorAnnot);
  String opName = getAnnotationElementValueAsString("name", operatorAnnot);
  if (Strings.isNullOrEmpty(opName)) {
    opName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, ClassName.get(opClass).simpleName());
  }
  // Build an endpoint for each method annotated with @Endpoint, which takes in parameter a scope
  // and, optionally, a list of arguments
  for (ExecutableElement opMethod : ElementFilter.methodsIn(opClass.getEnclosedElements())) {
    AnnotationMirror endpointAnnot =
        getAnnotationMirror(opMethod, elements.getName(T_ENDPOINT.toString()));
    if (endpointAnnot != null) {
      if (!opMethod.getModifiers().containsAll(Arrays.asList(Modifier.STATIC, Modifier.PUBLIC))) {
        throw new IllegalArgumentException(
            "Endpoint " + opMethod + " of class " + opClass + " must be static and public");
      }
      if (opMethod.getParameters().isEmpty() ||
          !((TypeElement)types.asElement(opMethod.getParameters().get(0).asType())).getQualifiedName()
              .equals(elements.getName(T_SCOPE.toString()))) {
        throw new IllegalArgumentException(
            "Endpoint " + opMethod + " of class " + opClass + " must take an instance of " + T_SCOPE
                + " as its first parameter");
      }
      String endpointGroup = getAnnotationElementValueAsString("group", endpointAnnot);
      if (endpointGroup.isEmpty()) {
        endpointGroup = opGroup;
      }
      String endpointName = getAnnotationElementValueAsString("name", endpointAnnot);
      if (endpointName.isEmpty()) {
        endpointName = opName;
      }
      boolean describeByClass =
          getAnnotationElementValueAsBoolean("describeByClass", endpointAnnot, false);
      boolean deprecated = opMethod.getAnnotation(Deprecated.class) != null || opClassDeprecated;
      MethodSpec method = buildOpMethod(endpointName, opClass, opMethod, describeByClass, deprecated);
      groupedMethods.put(endpointGroup, method);
    }
  }
}
 
源代码13 项目: AndServer   文件: ControllerProcessor.java
private void createHandlerAdapter(String registerPackageName,
    Map<TypeElement, List<ExecutableElement>> controllers) {
    Map<String, List<String>> adapterMap = new HashMap<>();
    for (Map.Entry<TypeElement, List<ExecutableElement>> entry : controllers.entrySet()) {
        TypeElement type = entry.getKey();
        List<ExecutableElement> executes = entry.getValue();
        mLog.i(String.format("------ Processing %s ------", type.getSimpleName()));

        String typeName = type.getQualifiedName().toString();
        Mapping typeMapping = getTypeMapping(type);
        validateMapping(typeMapping, typeName);

        TypeName controllerType = TypeName.get(type.asType());
        FieldSpec hostField = FieldSpec.builder(controllerType, "mHost", Modifier.PRIVATE).build();
        FieldSpec mappingField = FieldSpec.builder(mMappingList, "mMappingMap", Modifier.PRIVATE).build();

        CodeBlock.Builder rootCode = CodeBlock.builder()
            .addStatement("this.mHost = new $T()", type)
            .addStatement("this.mMappingMap = new $T<>()", LinkedHashMap.class);
        for (ExecutableElement execute : executes) {
            Mapping mapping = getExecuteMapping(execute);
            validateExecuteMapping(mapping, typeName + "#" + execute.getSimpleName().toString() + "()");

            mapping = new Merge(typeMapping, mapping);
            rootCode.beginControlFlow("\n").addStatement("$T mapping = new $T()", mMapping, mMapping);
            addMapping(rootCode, mapping);

            Addition addition = execute.getAnnotation(Addition.class);
            rootCode.add("\n").addStatement("$T addition = new $T()", mAddition, mAddition);
            addAddition(rootCode, addition);

            String handlerName = createHandler(type, execute, mapping.path(), mapping.isRest());
            rootCode.addStatement("$L handler = new $L(mHost, mapping, addition, $L)", handlerName, handlerName,
                mapping.isRest()).addStatement("mMappingMap.put(mapping, handler)").endControlFlow();
        }
        MethodSpec rootMethod = MethodSpec.constructorBuilder()
            .addModifiers(Modifier.PUBLIC)
            .addCode(rootCode.build())
            .build();

        MethodSpec mappingMethod = MethodSpec.methodBuilder("getMappingMap")
            .addAnnotation(Override.class)
            .addModifiers(Modifier.PROTECTED)
            .returns(mMappingList)
            .addStatement("return mMappingMap")
            .build();

        MethodSpec hostMethod = MethodSpec.methodBuilder("getHost")
            .addAnnotation(Override.class)
            .addModifiers(Modifier.PROTECTED)
            .returns(controllerType)
            .addStatement("return mHost")
            .build();

        String adapterPackageName = getPackageName(type).getQualifiedName().toString();
        String className = String.format("%sAdapter", type.getSimpleName());
        TypeSpec adapterClass = TypeSpec.classBuilder(className)
            .addJavadoc(Constants.DOC_EDIT_WARN)
            .addModifiers(Modifier.PUBLIC, Modifier.FINAL)
            .superclass(mMappingAdapter)
            .addField(hostField)
            .addField(mappingField)
            .addMethod(rootMethod)
            .addMethod(mappingMethod)
            .addMethod(hostMethod)
            .build();

        JavaFile javaFile = JavaFile.builder(adapterPackageName, adapterClass).build();
        try {
            javaFile.writeTo(mFiler);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        String group = getGroup(type);
        List<String> adapterList = adapterMap.get(group);
        if (CollectionUtils.isEmpty(adapterList)) {
            adapterList = new ArrayList<>();
            adapterMap.put(group, adapterList);
        }
        adapterList.add(adapterPackageName + "." + className);
    }

    if (!adapterMap.isEmpty()) {
        createRegister(registerPackageName, adapterMap);
    }
}
 
源代码14 项目: openjdk-8   文件: InlineAnnotationReaderImpl.java
public boolean hasMethodAnnotation(Class<? extends Annotation> a, ExecutableElement method) {
    return method.getAnnotation(a)!=null;
}
 
源代码15 项目: TencentKona-8   文件: InlineAnnotationReaderImpl.java
public boolean hasMethodAnnotation(Class<? extends Annotation> a, ExecutableElement method) {
    return method.getAnnotation(a)!=null;
}
 
源代码16 项目: jdk8u60   文件: WebServiceVisitor.java
protected boolean isLegalMethod(ExecutableElement method, TypeElement typeElement) {
    WebMethod webMethod = method.getAnnotation(WebMethod.class);
    //SEI cannot have methods with @WebMethod(exclude=true)
    if (typeElement.getKind().equals(ElementKind.INTERFACE) && webMethod != null && webMethod.exclude())
        builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeElement.getQualifiedName(), method.toString()), method);
    // With https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577, hasWebMethods has no effect
    if (hasWebMethods && webMethod == null) // backwards compatibility (for legacyWebMethod computation)
        return true;

    if ((webMethod != null) && webMethod.exclude()) {
        return true;
    }
    /*
    This check is not needed as Impl class is already checked that it is not abstract.
    if (typeElement instanceof TypeElement && method.getModifiers().contains(Modifier.ABSTRACT)) {  // use Kind.equals instead of instanceOf
        builder.processError(method.getPosition(), WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeElement.getQualifiedName(), method.getSimpleName()));
        return false;
    }
    */
    TypeMirror returnType = method.getReturnType();
    if (!isLegalType(returnType)) {
        builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(),
                method.getSimpleName(),
                returnType), method);
    }
    boolean isOneWay = method.getAnnotation(Oneway.class) != null;
    if (isOneWay && !isValidOneWayMethod(method, typeElement))
        return false;

    SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class);
    if (soapBinding != null) {
        if (soapBinding.style().equals(SOAPBinding.Style.RPC)) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeElement.getQualifiedName(), method.toString()), method);
        }
    }

    int paramIndex = 0;
    for (VariableElement parameter : method.getParameters()) {
        if (!isLegalParameter(parameter, method, typeElement, paramIndex++))
            return false;
    }

    if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) {
        VariableElement outParam = getOutParameter(method);
        int inParams = getModeParameterCount(method, WebParam.Mode.IN);
        int outParams = getModeParameterCount(method, WebParam.Mode.OUT);
        if (inParams != 1) {
            builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeElement.getQualifiedName(), method.toString()), method);
        }
        if (returnType.accept(NO_TYPE_VISITOR, null)) {
            if (outParam == null && !isOneWay) {
                builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_OUT(typeElement.getQualifiedName(), method.toString()), method);
            }
            if (outParams != 1) {
                if (!isOneWay && outParams != 0)
                    builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeElement.getQualifiedName(), method.toString()), method);
            }
        } else {
            if (outParams > 0) {
                builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam);
            }
        }
    }
    return true;
}
 
源代码17 项目: RetroFacebook   文件: RetroFacebookProcessor.java
public boolean buildIsGet(ExecutableElement method) {
    // TODO duplicated routine
    return method.getAnnotation(retrofacebook.RetroFacebook.GET.class) != null;
}
 
源代码18 项目: YoDao   文件: RepositoryParser.java
private static List<DaoMethod> parserMethods(Element element) {
	boolean isInterface = element.getKind().isInterface();
	List<DaoMethod> methods = new ArrayList<DaoMethod>();
	List<? extends Element> elems = element.getEnclosedElements();
	for (Element e : elems) {
		if (e instanceof ExecutableElement
				&& e.getKind() == ElementKind.METHOD) {
			ExecutableElement executableElement = (ExecutableElement) e;
			TypeElement enclosingElement = (TypeElement) e
					.getEnclosingElement();
			if (isInterface || isAbstract(executableElement)) {
				DaoMethod method = new DaoMethod();
				String methodName = executableElement.getSimpleName()
						.toString();
				method.setMethodName(methodName);
				String returnType = executableElement.getReturnType()
						.toString();
				method.setReturnType(returnType);
				com.yoda.yodao.annotation.Query query = executableElement
						.getAnnotation(com.yoda.yodao.annotation.Query.class);
				if (query != null) {
					method.setSql(query.value());
				}

				List<? extends VariableElement> parameters = executableElement
						.getParameters();
				int count = parameters.size();
				if (parameters != null && count > 0) {
					DaoParam[] params = new DaoParam[count];
					for (int i = 0; i < count; i++) {
						VariableElement param = parameters.get(i);
						String paramType = param.asType().toString();
						String paramName = param.getSimpleName().toString();
						params[i] = new DaoParam(paramName, paramType);
					}
					method.setMethodParams(params);
				}

				method.setElement(e);
				methods.add(method);
			}
		}
	}

	return methods;
}
 
源代码19 项目: RetroFacebook   文件: RetroFacebookProcessor.java
public boolean buildIsPost(ExecutableElement method) {
    // TODO duplicated routine
    return method.getAnnotation(retrofacebook.RetroFacebook.POST.class) != null;
}
 
源代码20 项目: sundrio   文件: TypeDefUtils.java
public static boolean isTerminal(ExecutableElement executableElement) {
    return executableElement.getAnnotation(Terminal.class) != null;
}