本文整理汇总了Java中com.github.javaparser.ast.type.TypeParameter类的典型用法代码示例。如果您正苦于以下问题:Java TypeParameter类的具体用法?Java TypeParameter怎么用?Java TypeParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeParameter类属于com.github.javaparser.ast.type包,在下文中一共展示了TypeParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
@Override
public Node visit(ClassOrInterfaceDeclaration _n, Object _arg) {
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
List<ClassOrInterfaceType> extendsList = visit(_n.getExtends(), _arg);
List<ClassOrInterfaceType> implementsList = visit(_n.getImplements(), _arg);
List<BodyDeclaration<?>> members = visit(_n.getMembers(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
ClassOrInterfaceDeclaration r = new ClassOrInterfaceDeclaration(
_n.getRange(),
_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
);
r.setComment(comment);
return r;
}
示例2: MethodDeclaration
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public MethodDeclaration(final EnumSet<Modifier> modifiers,
final List<AnnotationExpr> annotations,
final List<TypeParameter> typeParameters,
final Type elementType,
final List<ArrayBracketPair> arrayBracketPairsAfterElementType,
final String name,
final List<Parameter> parameters,
final List<ArrayBracketPair> arrayBracketPairsAfterParameterList,
final List<ReferenceType> throws_,
final BlockStmt body) {
super(annotations);
setModifiers(modifiers);
setTypeParameters(typeParameters);
setElementType(elementType);
setName(name);
setParameters(parameters);
setArrayBracketPairsAfterElementType(arrayBracketPairsAfterElementType);
setArrayBracketPairsAfterParameterList(arrayBracketPairsAfterParameterList);
setThrows(throws_);
setBody(body);
}
示例3: visit
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
@Override public void visit(final ConstructorDeclaration n, final A arg) {
visitComment(n.getComment(), arg);
visitAnnotations(n, arg);
if (n.getTypeParameters() != null) {
for (final TypeParameter t : n.getTypeParameters()) {
t.accept(this, arg);
}
}
n.getNameExpr().accept(this, arg);
if (n.getParameters() != null) {
for (final Parameter p : n.getParameters()) {
p.accept(this, arg);
}
}
if (n.getThrows() != null) {
for (final ReferenceType name : n.getThrows()) {
name.accept(this, arg);
}
}
n.getBody().accept(this, arg);
}
示例4: toTypeDeclaration
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public static ReferenceTypeDeclaration toTypeDeclaration(Node node, TypeSolver typeSolver) {
if (node instanceof ClassOrInterfaceDeclaration) {
if (((ClassOrInterfaceDeclaration) node).isInterface()) {
return new JavaParserInterfaceDeclaration((ClassOrInterfaceDeclaration) node, typeSolver);
} else {
return new JavaParserClassDeclaration((ClassOrInterfaceDeclaration) node, typeSolver);
}
} else if (node instanceof TypeParameter) {
return new JavaParserTypeParameter((TypeParameter) node, typeSolver);
} else if (node instanceof EnumDeclaration) {
return new JavaParserEnumDeclaration((EnumDeclaration) node, typeSolver);
} else if (node instanceof AnnotationDeclaration) {
return new JavaParserAnnotationDeclaration((AnnotationDeclaration) node, typeSolver);
} else {
throw new IllegalArgumentException(node.getClass().getCanonicalName());
}
}
示例5: toTypeDeclaration
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public static ResolvedReferenceTypeDeclaration toTypeDeclaration(Node node, TypeSolver typeSolver) {
if (node instanceof ClassOrInterfaceDeclaration) {
if (((ClassOrInterfaceDeclaration) node).isInterface()) {
return new JavaParserInterfaceDeclaration((ClassOrInterfaceDeclaration) node, typeSolver);
} else {
return new JavaParserClassDeclaration((ClassOrInterfaceDeclaration) node, typeSolver);
}
} else if (node instanceof TypeParameter) {
return new JavaParserTypeParameter((TypeParameter) node, typeSolver);
} else if (node instanceof EnumDeclaration) {
return new JavaParserEnumDeclaration((EnumDeclaration) node, typeSolver);
} else if (node instanceof AnnotationDeclaration) {
return new JavaParserAnnotationDeclaration((AnnotationDeclaration) node, typeSolver);
} else {
throw new IllegalArgumentException(node.getClass().getCanonicalName());
}
}
示例6: printTypeParameters
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
private void printTypeParameters(final NodeList<TypeParameter> args, final Void arg) {
if (!isNullOrEmpty(args)) {
printer.print("<");
for (final Iterator<TypeParameter> i = args.iterator(); i.hasNext(); ) {
final TypeParameter t = i.next();
t.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
printer.print(">");
}
}
示例7: ClassOrInterfaceDeclaration
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public ClassOrInterfaceDeclaration(final EnumSet<Modifier> modifiers,
final List<AnnotationExpr> annotations, final boolean isInterface,
final String name,
final List<TypeParameter> typeParameters,
final List<ClassOrInterfaceType> extendsList,
final List<ClassOrInterfaceType> implementsList,
final List<BodyDeclaration<?>> members) {
super(annotations, modifiers, name, members);
setInterface(isInterface);
setTypeParameters(typeParameters);
setExtends(extendsList);
setImplements(implementsList);
}
示例8: ConstructorDeclaration
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public ConstructorDeclaration(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations,
List<TypeParameter> typeParameters,
String name, List<Parameter> parameters, List<ReferenceType> throws_,
BlockStmt block) {
super(annotations);
setModifiers(modifiers);
setTypeParameters(typeParameters);
setName(name);
setParameters(parameters);
setThrows(throws_);
setBody(block);
}
示例9: visit
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
@Override public Boolean visit(final TypeParameter n1, final Node arg) {
final TypeParameter n2 = (TypeParameter) arg;
if (!objEquals(n1.getName(), n2.getName())) {
return false;
}
if (!nodesEquals(n1.getTypeBound(), n2.getTypeBound())) {
return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
return false;
}
return true;
}
示例10: visit
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
@Override public Node visit(final ClassOrInterfaceDeclaration n, final A arg) {
visitAnnotations(n, arg);
visitComment(n, arg);
final List<TypeParameter> typeParameters = n.getTypeParameters();
if (typeParameters != null) {
for (int i = 0; i < typeParameters.size(); i++) {
typeParameters.set(i, (TypeParameter) typeParameters.get(i).accept(this, arg));
}
removeNulls(typeParameters);
}
final List<ClassOrInterfaceType> extendz = n.getExtends();
if (extendz != null) {
for (int i = 0; i < extendz.size(); i++) {
extendz.set(i, (ClassOrInterfaceType) extendz.get(i).accept(this, arg));
}
removeNulls(extendz);
}
final List<ClassOrInterfaceType> implementz = n.getImplements();
if (implementz != null) {
for (int i = 0; i < implementz.size(); i++) {
implementz.set(i, (ClassOrInterfaceType) implementz.get(i).accept(this, arg));
}
removeNulls(implementz);
}
final List<BodyDeclaration<?>> members = n.getMembers();
if (members != null) {
for (int i = 0; i < members.size(); i++) {
members.set(i, (BodyDeclaration<?>) members.get(i).accept(this, arg));
}
removeNulls(members);
}
return n;
}
示例11: getTypeParameters
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public List<TypeParameter> getTypeParameters() {
typeParameters = ensureNotNull(typeParameters);
return typeParameters;
}
示例12: setTypeParameters
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
/**
*
* @param typeParameters a null value is currently treated as an empty list. This behavior could change
* in the future, so please avoid passing null
*/
public ClassOrInterfaceDeclaration setTypeParameters(final List<TypeParameter> typeParameters) {
this.typeParameters = typeParameters;
setAsParentNodeOf(this.typeParameters);
return this;
}
示例13: setTypeParameters
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public ConstructorDeclaration setTypeParameters(List<TypeParameter> typeParameters) {
this.typeParameters = typeParameters;
setAsParentNodeOf(this.typeParameters);
return this;
}
示例14: setTypeParameters
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public MethodDeclaration setTypeParameters(final List<TypeParameter> typeParameters) {
this.typeParameters = typeParameters;
setAsParentNodeOf(typeParameters);
return this;
}
示例15: JavaParserTypeVariableDeclaration
import com.github.javaparser.ast.type.TypeParameter; //导入依赖的package包/类
public JavaParserTypeVariableDeclaration(TypeParameter wrappedNode, TypeSolver typeSolver) {
this.wrappedNode = wrappedNode;
this.typeSolver = typeSolver;
}