本文整理汇总了Java中lombok.ast.MethodDeclaration.astParameters方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDeclaration.astParameters方法的具体用法?Java MethodDeclaration.astParameters怎么用?Java MethodDeclaration.astParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lombok.ast.MethodDeclaration
的用法示例。
在下文中一共展示了MethodDeclaration.astParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOnDrawMethod
import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
/**
* 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;
}
示例2: isOnMeasureMethod
import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
/**
* 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;
}
示例3: isLayoutMethod
import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
/**
* 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;
}
示例4: isOnLayoutMethod
import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
/**
* Returns true if this method looks like it's overriding
* android.view.View's
* {@code protected void onLayout(boolean changed, int left, int top,
* int right, int bottom)}
*/
private static boolean isOnLayoutMethod(MethodDeclaration node) {
if (ON_LAYOUT.equals(node.astMethodName().astValue())) {
StrictListAccessor<VariableDefinition, MethodDeclaration> parameters =
node.astParameters();
if (parameters != null && parameters.size() == 5) {
Iterator<VariableDefinition> iterator = parameters.iterator();
if (!iterator.hasNext()) {
return false;
}
// Ensure that the argument list matches boolean, int, int, int, int
TypeReferencePart type = iterator.next().astTypeReference().astParts().last();
if (!type.getTypeName().equals(TYPE_BOOLEAN) || !iterator.hasNext()) {
return false;
}
for (int i = 0; i < 4; i++) {
type = iterator.next().astTypeReference().astParts().last();
if (!type.getTypeName().equals(TYPE_INT)) {
return false;
}
if (!iterator.hasNext()) {
return i == 3;
}
}
}
}
return false;
}
示例5: isViewAdapterMethod
import lombok.ast.MethodDeclaration; //导入方法依赖的package包/类
/**
* Returns true if this method looks like it's overriding android.widget.Adapter's getView
* method: getView(int position, View convertView, ViewGroup parent)
*/
private static boolean isViewAdapterMethod(MethodDeclaration node) {
if (GET_VIEW.equals(node.astMethodName().astValue())) {
StrictListAccessor<VariableDefinition, MethodDeclaration> parameters =
node.astParameters();
if (parameters != null && parameters.size() == 3) {
Iterator<VariableDefinition> iterator = parameters.iterator();
if (!iterator.hasNext()) {
return false;
}
VariableDefinition first = iterator.next();
if (!first.astTypeReference().astParts().last().getTypeName().equals(
TYPE_INT)) {
return false;
}
if (!iterator.hasNext()) {
return false;
}
VariableDefinition second = iterator.next();
if (!second.astTypeReference().astParts().last().getTypeName().equals(
VIEW)) {
return false;
}
if (!iterator.hasNext()) {
return false;
}
VariableDefinition third = iterator.next();
//noinspection RedundantIfStatement
if (!third.astTypeReference().astParts().last().getTypeName().equals(
VIEW_GROUP)) {
return false;
}
return true;
}
}
return false;
}