@CopyMethod static String getTypeName(TypeReference self) { StringBuilder out = new StringBuilder(); for (TypeReferencePart p : self.astParts()) { if (out.length() > 0) out.append("."); out.append(p.getTypeName()); } for (int i = 0; i < self.astArrayDimensions(); i++) out.append("[]"); return out.toString(); }
@CopyMethod static String getTypeName(TypeReference self) { StringBuilder out = new StringBuilder(); for (TypeReferencePart p : self.astParts()) { if (out.length() > 0) out.append("."); out.append(p.getTypeName()); } for (int i = 0; i < self.astArrayDimensions(); i++) out.append("[]"); return out.toString(); }
@CopyMethod static String getTypeName(TypeReference self) { StringBuilder out = new StringBuilder(); for (TypeReferencePart p : self.astParts()) { if (out.length() > 0) out.append("."); out.append(p.getTypeName()); } for (int i = 0; i < self.astArrayDimensions(); i++) out.append("[]"); return out.toString(); }
if (!type.getTypeName().equals(TYPE_BOOLEAN) || !iterator.hasNext()) { return false; if (!type.getTypeName().equals(TYPE_INT)) { return false;
if (!first.astTypeReference().astParts().last().getTypeName().equals( TYPE_INT)) { return false; if (!second.astTypeReference().astParts().last().getTypeName().equals( VIEW)) { return false; if (!third.astTypeReference().astParts().last().getTypeName().equals( VIEW_GROUP)) { return false;
/** * Returns true if this method looks like it's overriding android.view.View's * {@code public void layout(int l, int t, int r, int b)} */ private static boolean isLayoutMethod(MethodDeclaration node) { if (LAYOUT.equals(node.astMethodName().astValue())) { StrictListAccessor<VariableDefinition, MethodDeclaration> parameters = node.astParameters(); if (parameters != null && parameters.size() == 4) { Iterator<VariableDefinition> iterator = parameters.iterator(); for (int i = 0; i < 4; i++) { if (!iterator.hasNext()) { return false; } VariableDefinition next = iterator.next(); TypeReferencePart type = next.astTypeReference().astParts().last(); if (!TYPE_INT.equals(type.getTypeName())) { return false; } } return true; } } return false; }
/** * Returns true if this method looks like it's overriding android.view.View's * {@code protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)} */ private static boolean isOnMeasureMethod(MethodDeclaration node) { if (ON_MEASURE.equals(node.astMethodName().astValue())) { StrictListAccessor<VariableDefinition, MethodDeclaration> parameters = node.astParameters(); if (parameters != null && parameters.size() == 2) { VariableDefinition arg0 = parameters.first(); VariableDefinition arg1 = parameters.last(); TypeReferencePart type1 = arg0.astTypeReference().astParts().last(); TypeReferencePart type2 = arg1.astTypeReference().astParts().last(); return TYPE_INT.equals(type1.getTypeName()) && TYPE_INT.equals(type2.getTypeName()); } } return false; }
/** * Returns true if this method looks like it's overriding android.view.View's * {@code protected void onDraw(Canvas canvas)} */ private static boolean isOnDrawMethod(MethodDeclaration node) { if (ON_DRAW.equals(node.astMethodName().astValue())) { StrictListAccessor<VariableDefinition, MethodDeclaration> parameters = node.astParameters(); if (parameters != null && parameters.size() == 1) { VariableDefinition arg0 = parameters.first(); TypeReferencePart type = arg0.astTypeReference().astParts().last(); String typeName = type.getTypeName(); if (typeName.equals(CANVAS)) { return true; } } } return false; }