private static List<Parameter> parseParametersOptional(MethodSpec spec, List<? extends VariableElement> types) { List<Parameter> parsedParams = new ArrayList<>(); int typeStartIndex = 0; List<ParameterSpec> specifications = spec.getOptional(); outer: for (int specIndex = 0; specIndex < specifications.size(); specIndex++) { ParameterSpec specification = specifications.get(specIndex); for (int typeIndex = typeStartIndex; typeIndex < types.size(); typeIndex++) { VariableElement variable = types.get(typeIndex); Parameter optionalParam = matchParameter(specification, variable, -1, -1); if (optionalParam != null) { parsedParams.add(optionalParam); typeStartIndex = typeIndex + 1; continue outer; } } } if (typeStartIndex < types.size()) { // not enough types found return null; } return parsedParams; }
private static List<Parameter> parseParametersOptional(MethodSpec spec, List<? extends VariableElement> types) { List<Parameter> parsedParams = new ArrayList<>(); int typeStartIndex = 0; List<ParameterSpec> specifications = spec.getOptional(); outer: for (int specIndex = 0; specIndex < specifications.size(); specIndex++) { ParameterSpec specification = specifications.get(specIndex); for (int typeIndex = typeStartIndex; typeIndex < types.size(); typeIndex++) { VariableElement variable = types.get(typeIndex); Parameter optionalParam = matchParameter(specification, variable, -1, -1); if (optionalParam != null) { parsedParams.add(optionalParam); typeStartIndex = typeIndex + 1; continue outer; } } } if (typeStartIndex < types.size()) { // not enough types found return null; } return parsedParams; }
private static Parameter matchAnnotatedParameter(MethodSpec spec, VariableElement variable) { for (ParameterSpec parameterSpec : spec.getAnnotations()) { if (parameterSpec.matches(variable)) { Parameter matchedParameter = matchParameter(parameterSpec, variable, -1, -1); if (matchedParameter != null) { matchedParameter.setLocalName(variable.getSimpleName().toString()); return matchedParameter; } } } return null; }
private static Parameter matchAnnotatedParameter(MethodSpec spec, VariableElement variable) { for (ParameterSpec parameterSpec : spec.getAnnotations()) { if (parameterSpec.matches(variable)) { Parameter matchedParameter = matchParameter(parameterSpec, variable, -1, -1); if (matchedParameter != null) { matchedParameter.setLocalName(variable.getSimpleName().toString()); return matchedParameter; } } } return null; }
Parameter resolvedParameter = matchParameter(specification, actualType, specVarArgsIndex, typeVarArgsIndex); if (resolvedParameter == null) { return null;
Parameter resolvedParameter = matchParameter(specification, actualType, specVarArgsIndex, typeVarArgsIndex); if (resolvedParameter == null) { return null;
public TemplateMethod parseImpl(MethodSpec methodSpecification, int naturalOrder, String id, ExecutableElement method, AnnotationMirror annotation, TypeMirror returnType, List<? extends VariableElement> parameterTypes) { ParameterSpec returnTypeSpec = methodSpecification.getReturnType(); Parameter returnTypeMirror = matchParameter(returnTypeSpec, new CodeVariableElement(returnType, "returnType"), -1, -1); if (returnTypeMirror == null) { if (isEmitErrors() && method != null) {
public TemplateMethod parseImpl(MethodSpec methodSpecification, int naturalOrder, String id, ExecutableElement method, AnnotationMirror annotation, TypeMirror returnType, List<? extends VariableElement> parameterTypes) { ParameterSpec returnTypeSpec = methodSpecification.getReturnType(); Parameter returnTypeMirror = matchParameter(returnTypeSpec, new CodeVariableElement(returnType, "returnType"), -1, -1); if (returnTypeMirror == null) { if (isEmitErrors() && method != null) {