本文整理汇总了Java中com.github.javaparser.ast.body.MultiTypeParameter.getTypes方法的典型用法代码示例。如果您正苦于以下问题:Java MultiTypeParameter.getTypes方法的具体用法?Java MultiTypeParameter.getTypes怎么用?Java MultiTypeParameter.getTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.body.MultiTypeParameter
的用法示例。
在下文中一共展示了MultiTypeParameter.getTypes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.body.MultiTypeParameter; //导入方法依赖的package包/类
@Override
public JCTree visit(final MultiTypeParameter n, final Object arg) {
//ARG0: JCModifiers mods
JCModifiers arg0;
long jcmodifier = setJCTreeModifiers(n.getModifiers(), 0);
arg0 = new AJCModifiers(make.Modifiers(jcmodifier), null);
/* TODO - Not supported yet
if (n.getAnnotations() != null) {
for (final AnnotationExpr a : n.getAnnotations()) {
JCTree result = a.accept(this, arg);
}
}
*/
//ARG1: Name name
Name arg1 = names.fromString(n.getId().getName());
//ARG2: JCExpression vartype
JCExpression arg2;
if (n.getTypes().size() > 1) {
List<JCExpression> typelist = List.<JCExpression>nil();
for (final com.github.javaparser.ast.type.Type type : n.getTypes()) {
typelist = typelist.append((JCExpression) type.accept(this, arg));
}
arg2 = new AJCTypeUnion(make.TypeUnion(typelist), null);
} else {
// Get the single element
arg2 = (JCExpression) n.getTypes().get(0).accept(this, arg);
}
//ARG3: JCExpression init
JCExpression arg3 = null;
return new AJCVariableDecl(make.VarDef(arg0, arg1, arg2, arg3), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
示例2: doIsEquals
import com.github.javaparser.ast.body.MultiTypeParameter; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean doIsEquals(MultiTypeParameter first, MultiTypeParameter second) {
if(!getMerger(VariableDeclaratorId.class).isEquals(first.getId(),second.getId())) return false;
List<Type> firstTypes = first.getTypes();
List<Type> secondTypes = second.getTypes();
if(firstTypes == null) return secondTypes == null;
if(secondTypes == null) return false;
if(firstTypes.size() != secondTypes.size()) return false;
for(Type ft : firstTypes){
boolean found = false;
AbstractMerger merger = getMerger(ft.getClass());
for(Type st : secondTypes){
if(merger.isEquals(ft, st)){
found = true; break;
}
}
if(!found) return false;
}
return true;
}
示例3: visit
import com.github.javaparser.ast.body.MultiTypeParameter; //导入方法依赖的package包/类
@Override
public Node visit(CatchClause _n, Object _arg) {
MultiTypeParameter except = cloneNodes(_n.getExcept(), _arg);
BlockStmt catchBlock = cloneNodes(_n.getCatchBlock(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
CatchClause r = new CatchClause(
_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
except.getModifiers(), except.getAnnotations(), except.getTypes(), except.getId(), catchBlock
);
r.setComment(comment);
return r;
}
示例4: visit
import com.github.javaparser.ast.body.MultiTypeParameter; //导入方法依赖的package包/类
@Override public void visit(final MultiTypeParameter n, final A arg) {
visitComment(n.getComment(), arg);
if (n.getAnnotations() != null) {
for (final AnnotationExpr a : n.getAnnotations()) {
a.accept(this, arg);
}
}
for (final Type type : n.getTypes()) {
type.accept(this, arg);
}
n.getId().accept(this, arg);
}
示例5: visit
import com.github.javaparser.ast.body.MultiTypeParameter; //导入方法依赖的package包/类
@Override public Node visit(MultiTypeParameter n, A arg) {
visit((BaseParameter) n, arg);
List<Type> types = new LinkedList<Type>();
for (Type type : n.getTypes()) {
types.add((Type) type.accept(this, arg));
}
n.setTypes(types);
return n;
}