/** * Get type name of this parameter. * For example if parameter is the short 'index', returns "short". */ public String typeName() { return (type instanceof ClassDoc || type instanceof TypeVariable) ? type.typeName() // omit formal type params or bounds : type.toString(); }
private static boolean equalParameters(@Nullable List<Object> expected, Parameter[] actual) { if (expected == null) return true; if (expected.size() != actual.length) return false; for (int i = 0; i < expected.size(); i++) { Object parameterType = expected.get(i); Type mdParameterType = actual[i].type(); ClassDoc mdParameterClassDoc = mdParameterType.asClassDoc(); if (mdParameterClassDoc == null) { if (!mdParameterType.toString().equals(parameterType)) return false; } else { if (!mdParameterClassDoc.equals(parameterType)) return false; } } return true; }
private static boolean equalParameters(@Nullable List<Object> expected, Parameter[] actual) { if (expected == null) return true; if (expected.size() != actual.length) return false; for (int i = 0; i < expected.size(); i++) { Object parameterType = expected.get(i); Type mdParameterType = actual[i].type(); ClassDoc mdParameterClassDoc = mdParameterType.asClassDoc(); if (mdParameterClassDoc == null) { if (!mdParameterType.toString().equals(parameterType)) return false; } else { if (!mdParameterClassDoc.equals(parameterType)) return false; } } return true; }
private String prettyPrintParameterList(ExecutableMemberDoc executableMemberDoc) { StringBuilder result = new StringBuilder().append('('); for (int i = 0; i < executableMemberDoc.parameters().length; i++) { Parameter parameter = executableMemberDoc.parameters()[i]; if (i > 0) { result.append(", "); } Type pt = parameter.type(); if (pt.isPrimitive()) { result.append(pt.toString()); continue; } // Show erasure type, not type variable name. ClassDoc cd = pt.asClassDoc(); assert cd != null : parameter; result.append(cd.name()); } result.append(')'); return result.toString(); } };
private String prettyPrintParameterList(ExecutableMemberDoc executableMemberDoc) { StringBuilder result = new StringBuilder().append('('); for (int i = 0; i < executableMemberDoc.parameters().length; i++) { Parameter parameter = executableMemberDoc.parameters()[i]; if (i > 0) { result.append(", "); } Type pt = parameter.type(); if (pt.isPrimitive()) { result.append(pt.toString()); continue; } // Show erasure type, not type variable name. ClassDoc cd = pt.asClassDoc(); assert cd != null : parameter; result.append(cd.name()); } result.append(')'); return result.toString(); } };
private MethodDoc getterForField(MethodDoc[] methods, MethodDoc propertyMethod) { final String propertyMethodName = propertyMethod.name(); final String fieldName = propertyMethodName.substring(0, propertyMethodName.lastIndexOf("Property")); final String fieldNameUppercased = "" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1); final String getterNamePattern; final String fieldTypeName = propertyMethod.returnType().toString(); if ("boolean".equals(fieldTypeName) || fieldTypeName.endsWith("BooleanProperty")) { getterNamePattern = "(is|get)" + fieldNameUppercased; } else { getterNamePattern = "get" + fieldNameUppercased; } for (MethodDoc methodDoc : methods) { if (Pattern.matches(getterNamePattern, methodDoc.name())) { if (0 == methodDoc.parameters().length && (methodDoc.isPublic() || methodDoc.isProtected())) { return methodDoc; } } } return null; }
!s.toString().equals("java.lang.Object") && !c.isEnum() && !hidden(s.asClassDoc())) {