本文整理汇总了Java中com.github.javaparser.ast.TypeParameter类的典型用法代码示例。如果您正苦于以下问题:Java TypeParameter类的具体用法?Java TypeParameter怎么用?Java TypeParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeParameter类属于com.github.javaparser.ast包,在下文中一共展示了TypeParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public void visit(final TypeParameter n, final Object arg) {
printer.printLn("TypeParameter");
printJavaComment(n.getComment(), arg);
if (n.getAnnotations() != null) {
for (AnnotationExpr ann : n.getAnnotations()) {
ann.accept(this, arg);
printer.print(" ");
}
}
printer.print(n.getName());
if (n.getTypeBound() != null) {
printer.print(" extends ");
for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(" & ");
}
}
}
}
示例2: doIsEquals
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public boolean doIsEquals(TypeParameter first, TypeParameter second) {
if(!StringUtils.equals(first.getName(),second.getName())) return false;
List<ClassOrInterfaceType> firstTypeBounds = first.getTypeBound();
List<ClassOrInterfaceType> secondTypeBounds = second.getTypeBound();
if(firstTypeBounds == null) return secondTypeBounds == null;
if(secondTypeBounds == null) return false;
if(firstTypeBounds.size() != secondTypeBounds.size()) return false;
AbstractMerger<ClassOrInterfaceType> merger = getMerger(ClassOrInterfaceType.class);
for(int i = 0; i < firstTypeBounds.size(); i++){
if(!merger.isEquals(firstTypeBounds.get(i),secondTypeBounds.get(i))){
return false;
}
}
return true;
}
示例3: visit
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public Node visit(ClassOrInterfaceDeclaration _n, Object _arg) {
JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _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.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
);
r.setComment(comment);
return r;
}
示例4: visit
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override public void visit(final TypeParameter n, final Object arg) {
printJavaComment(n.getComment(), arg);
if (n.getAnnotations() != null) {
for (AnnotationExpr ann : n.getAnnotations()) {
ann.accept(this, arg);
printer.print(" ");
}
}
printer.print(n.getName());
if (!isNullOrEmpty(n.getTypeBound())) {
printer.print(" extends ");
for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext();) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(" & ");
}
}
}
}
示例5: visit
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override public void visit(final TypeParameter n, final Object arg) {
printJavaComment(n.getComment(), arg);
if (n.getAnnotations() != null) {
for (AnnotationExpr ann : n.getAnnotations()) {
ann.accept(this, arg);
printer.print(" ");
}
}
printer.print(n.getName());
if (n.getTypeBound() != null) {
printer.print(" extends ");
for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext();) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(" & ");
}
}
}
}
示例6: visit
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public Node visit(ClassOrInterfaceDeclaration _n, Object _arg) {
JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _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.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
);
r.setComment(comment);
return copyExtras(_n, r);
}
示例7: visit
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public void visit(final TypeParameter n, final Object arg) {
printJavaComment(n.getComment(), arg);
if (n.getAnnotations() != null) {
for (AnnotationExpr ann : n.getAnnotations()) {
ann.accept(this, arg);
printer.print(" ");
}
}
printer.print(resolveTypeParamName(n));
if (!isNullOrEmpty(n.getTypeBound())) {
printer.print(" extends ");
for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(" & ");
}
}
}
}
示例8: typeVariableName
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
private TypeVariableName typeVariableName(TypeParameter typeParameter, TypeNameDetermination typeNameDetermination) {
List<ClassOrInterfaceType> typeBounds = typeParameter.getTypeBound();
TypeName[] typeNames = typeBounds.stream()
.map(typeNameDetermination::determineTypeName)
.toArray(TypeName[]::new);
return TypeVariableName.get(typeParameter.getName(), typeNames);
}
示例9: printTypeParameters
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public void printTypeParameters(final List<TypeParameter> args, final Object 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(">");
}
}
示例10: visit
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public JCTree visit(final TypeParameter n, final Object arg) {
//ARG0: Name name
Name arg0 = names.fromString(n.getName());
//ARG1: List<JCExpression> bounds
List<JCExpression> arg1 = List.<JCExpression>nil();
if (n.getTypeBound() != null) {
for (final ClassOrInterfaceType c : n.getTypeBound()) {
arg1 = arg1.append((JCExpression) c.accept(this, arg));
}
}
return new AJCTypeParameter(make.TypeParameter(arg0, arg1), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
示例11: doMerge
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
@Override
public TypeParameter doMerge(TypeParameter first, TypeParameter second) {
TypeParameter tp = new TypeParameter();
tp.setName(first.getName());
tp.setTypeBound(first.getTypeBound());
tp.setAnnotations(mergeCollections(first.getAnnotations(), second.getAnnotations()));
return tp;
}
示例12: apply
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public TypeRef apply(TypeParameter item) {
List<TypeRef> interfaces = new ArrayList<TypeRef>();
for (ClassOrInterfaceType classOrInterfaceType : item.getTypeBound()) {
}
return null;
}
示例13: apply
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public TypeParamDef apply(TypeParameter typeParameter) {
List<ClassRef> bounds = new ArrayList<ClassRef>();
for (ClassOrInterfaceType classOrInterfaceType : typeParameter.getTypeBound()) {
bounds.add((ClassRef) CLASS_OR_TYPEPARAM_REF.apply(classOrInterfaceType));
}
return new TypeParamDefBuilder()
.withName(typeParameter.getName())
.withBounds(bounds)
.build();
}
示例14: ClassOrInterfaceDeclaration
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public ClassOrInterfaceDeclaration(final int 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);
}
示例15: ConstructorDeclaration
import com.github.javaparser.ast.TypeParameter; //导入依赖的package包/类
public ConstructorDeclaration(int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters,
String name, List<Parameter> parameters, List<NameExpr> throws_, BlockStmt block) {
super(annotations);
setModifiers(modifiers);
setTypeParameters(typeParameters);
setName(name);
setParameters(parameters);
setThrows(throws_);
setBlock(block);
}