org.eclipse.jdt.internal.core.util.Util.typeSignature()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(16.8k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.eclipse.jdt.internal.core.util.Util.typeSignature()方法的一些代码示例,展示了Util.typeSignature()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.typeSignature()方法的具体详情如下:
包路径:org.eclipse.jdt.internal.core.util.Util
类名称:Util
方法名:typeSignature

Util.typeSignature介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

public static String[] typeParameterSignatures(AbstractMethodDeclaration method) {
  Argument[] args = method.arguments;
  if (args != null) {
    int length = args.length;
    String[] signatures = new String[length];
    for (int i = 0; i < args.length; i++) {
      Argument arg = args[i];
      signatures[i] = typeSignature(arg.type);
    }
    return signatures;
  }
  return CharOperation.NO_STRINGS;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public static String[] typeParameterSignatures(AbstractMethodDeclaration method) {
  Argument[] args = method.arguments;
  if (args != null) {
    int length = args.length;
    String[] signatures = new String[length];
    for (int i = 0; i < args.length; i++) {
      Argument arg = args[i];
      signatures[i] = typeSignature(arg.type);
    }
    return signatures;
  }
  return CharOperation.NO_STRINGS;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

public static String[] typeParameterSignatures(AbstractMethodDeclaration method) {
  Argument[] args = method.arguments;
  if (args != null) {
    int length = args.length;
    String[] signatures = new String[length];
    for (int i = 0; i < args.length; i++) {
      Argument arg = args[i];
      signatures[i] = typeSignature(arg.type);
    }
    return signatures;
  }
  return CharOperation.NO_STRINGS;
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

public static String[] typeParameterSignatures(AbstractMethodDeclaration method) {
  Argument[] args = method.arguments;
  if (args != null) {
    int length = args.length;
    String[] signatures = new String[length];
    for (int i = 0; i < args.length; i++) {
      Argument arg = args[i];
      signatures[i] = typeSignature(arg.type);
    }
    return signatures;
  }
  return CharOperation.NO_STRINGS;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public static String[] typeParameterSignatures(AbstractMethodDeclaration method) {
  Argument[] args = method.arguments;
  if (args != null) {
    int length = args.length;
    String[] signatures = new String[length];
    for (int i = 0; i < args.length; i++) {
      Argument arg = args[i];
      signatures[i] = typeSignature(arg.type);
    }
    return signatures;
  }
  return CharOperation.NO_STRINGS;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public static String[] typeParameterSignatures(AbstractMethodDeclaration method) {
  Argument[] args = method.arguments;
  if (args != null) {
    int length = args.length;
    String[] signatures = new String[length];
    for (int i = 0; i < args.length; i++) {
      Argument arg = args[i];
      signatures[i] = typeSignature(arg.type);
    }
    return signatures;
  }
  return CharOperation.NO_STRINGS;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

public static String[] typeParameterSignatures(AbstractMethodDeclaration method) {
  Argument[] args = method.arguments;
  if (args != null) {
    int length = args.length;
    String[] signatures = new String[length];
    for (int i = 0; i < args.length; i++) {
      Argument arg = args[i];
      signatures[i] = typeSignature(arg.type);
    }
    return signatures;
  }
  return CharOperation.NO_STRINGS;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

public void acceptLocalVariable(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  IJavaElement parent = findLocalElement(local.sourceStart); // findLocalElement() cannot find local variable
  LocalVariable localVar = null;
  if(parent != null) {
    localVar = new LocalVariable(
        (JavaElement)parent,
        new String(local.name),
        local.declarationSourceStart,
        local.declarationSourceEnd,
        local.sourceStart,
        local.sourceEnd,
        Util.typeSignature(local.type),
        local.annotations,
        local.modifiers,
        local.getKind() == AbstractVariableDeclaration.PARAMETER);
  }
  if (localVar != null) {
    addElement(localVar);
    if(SelectionEngine.DEBUG){
      System.out.print("SELECTION - accept local variable("); //$NON-NLS-1$
      System.out.print(localVar.toString());
      System.out.println(")"); //$NON-NLS-1$
    }
  }
}
/**

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public AbstractMethodDeclaration findMethod(IMethod methodHandle) {
  TypeDeclaration typeDecl = findType((IType)methodHandle.getParent());
  if (typeDecl == null) return null;
  AbstractMethodDeclaration[] methods = typeDecl.methods;
  if (methods != null) {
    char[] selector = methodHandle.getElementName().toCharArray();
    String[] parameterTypeSignatures = methodHandle.getParameterTypes();
    int parameterCount = parameterTypeSignatures.length;
    nextMethod: for (int i = 0, length = methods.length; i < length; i++) {
      AbstractMethodDeclaration method = methods[i];
      if (CharOperation.equals(selector, method.selector)) {
        Argument[] args = method.arguments;
        int argsLength = args == null ? 0 : args.length;
        if (argsLength == parameterCount) {
          for (int j = 0; j < parameterCount; j++) {
            TypeReference type = args[j].type;
            String signature = Util.typeSignature(type);
            if (!signature.equals(parameterTypeSignatures[j])) {
              continue nextMethod;
            }
          }
          return method;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

public AbstractMethodDeclaration findMethod(IMethod methodHandle) {
  TypeDeclaration typeDecl = findType((IType)methodHandle.getParent());
  if (typeDecl == null) return null;
  AbstractMethodDeclaration[] methods = typeDecl.methods;
  if (methods != null) {
    char[] selector = methodHandle.getElementName().toCharArray();
    String[] parameterTypeSignatures = methodHandle.getParameterTypes();
    int parameterCount = parameterTypeSignatures.length;
    nextMethod: for (int i = 0, length = methods.length; i < length; i++) {
      AbstractMethodDeclaration method = methods[i];
      if (CharOperation.equals(selector, method.selector)) {
        Argument[] args = method.arguments;
        int argsLength = args == null ? 0 : args.length;
        if (argsLength == parameterCount) {
          for (int j = 0; j < parameterCount; j++) {
            TypeReference type = args[j].type;
            String signature = Util.typeSignature(type);
            if (!signature.equals(parameterTypeSignatures[j])) {
              continue nextMethod;
            }
          }
          return method;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

public AbstractMethodDeclaration findMethod(IMethod methodHandle) {
  TypeDeclaration typeDecl = findType((IType)methodHandle.getParent());
  if (typeDecl == null) return null;
  AbstractMethodDeclaration[] methods = typeDecl.methods;
  if (methods != null) {
    char[] selector = methodHandle.getElementName().toCharArray();
    String[] parameterTypeSignatures = methodHandle.getParameterTypes();
    int parameterCount = parameterTypeSignatures.length;
    nextMethod: for (int i = 0, length = methods.length; i < length; i++) {
      AbstractMethodDeclaration method = methods[i];
      if (CharOperation.equals(selector, method.selector)) {
        Argument[] args = method.arguments;
        int argsLength = args == null ? 0 : args.length;
        if (argsLength == parameterCount) {
          for (int j = 0; j < parameterCount; j++) {
            TypeReference type = args[j].type;
            String signature = Util.typeSignature(type);
            if (!signature.equals(parameterTypeSignatures[j])) {
              continue nextMethod;
            }
          }
          return method;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public AbstractMethodDeclaration findMethod(IMethod methodHandle) {
  TypeDeclaration typeDecl = findType((IType)methodHandle.getParent());
  if (typeDecl == null) return null;
  AbstractMethodDeclaration[] methods = typeDecl.methods;
  if (methods != null) {
    char[] selector = methodHandle.getElementName().toCharArray();
    String[] parameterTypeSignatures = methodHandle.getParameterTypes();
    int parameterCount = parameterTypeSignatures.length;
    nextMethod: for (int i = 0, length = methods.length; i < length; i++) {
      AbstractMethodDeclaration method = methods[i];
      if (CharOperation.equals(selector, method.selector)) {
        Argument[] args = method.arguments;
        int argsLength = args == null ? 0 : args.length;
        if (argsLength == parameterCount) {
          for (int j = 0; j < parameterCount; j++) {
            TypeReference type = args[j].type;
            String signature = Util.typeSignature(type);
            if (!signature.equals(parameterTypeSignatures[j])) {
              continue nextMethod;
            }
          }
          return method;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public AbstractMethodDeclaration findMethod(IMethod methodHandle) {
  TypeDeclaration typeDecl = findType((IType)methodHandle.getParent());
  if (typeDecl == null) return null;
  AbstractMethodDeclaration[] methods = typeDecl.methods;
  if (methods != null) {
    char[] selector = methodHandle.getElementName().toCharArray();
    String[] parameterTypeSignatures = methodHandle.getParameterTypes();
    int parameterCount = parameterTypeSignatures.length;
    nextMethod: for (int i = 0, length = methods.length; i < length; i++) {
      AbstractMethodDeclaration method = methods[i];
      if (CharOperation.equals(selector, method.selector)) {
        Argument[] args = method.arguments;
        int argsLength = args == null ? 0 : args.length;
        if (argsLength == parameterCount) {
          for (int j = 0; j < parameterCount; j++) {
            TypeReference type = args[j].type;
            String signature = Util.typeSignature(type);
            if (!signature.equals(parameterTypeSignatures[j])) {
              continue nextMethod;
            }
          }
          return method;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

public AbstractMethodDeclaration findMethod(IMethod methodHandle) {
  TypeDeclaration typeDecl = findType((IType)methodHandle.getParent());
  if (typeDecl == null) return null;
  AbstractMethodDeclaration[] methods = typeDecl.methods;
  if (methods != null) {
    char[] selector = methodHandle.getElementName().toCharArray();
    String[] parameterTypeSignatures = methodHandle.getParameterTypes();
    int parameterCount = parameterTypeSignatures.length;
    nextMethod: for (int i = 0, length = methods.length; i < length; i++) {
      AbstractMethodDeclaration method = methods[i];
      if (CharOperation.equals(selector, method.selector)) {
        Argument[] args = method.arguments;
        int argsLength = args == null ? 0 : args.length;
        if (argsLength == parameterCount) {
          for (int j = 0; j < parameterCount; j++) {
            TypeReference type = args[j].type;
            String signature = Util.typeSignature(type);
            if (!signature.equals(parameterTypeSignatures[j])) {
              continue nextMethod;
            }
          }
          return method;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

private JavaElement getJavaElement(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  JavaElement parent = null;
  ReferenceContext referenceContext = binding.declaringScope.referenceContext();
  if (referenceContext instanceof AbstractMethodDeclaration) {
    AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
    parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
  } else if (referenceContext instanceof TypeDeclaration){
    // Local variable is declared inside an initializer
    TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
    JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
    parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
  }
  if (parent == null) return null;
  return new LocalVariable(
      parent,
      new String(local.name),
      local.declarationSourceStart,
      local.declarationSourceEnd,
      local.sourceStart,
      local.sourceEnd,
      Util.typeSignature(local.type),
      binding.declaration.annotations,
      local.modifiers,
      local.getKind() == AbstractVariableDeclaration.PARAMETER);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

private JavaElement getJavaElement(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  JavaElement parent = null;
  ReferenceContext referenceContext = binding.declaringScope.referenceContext();
  if (referenceContext instanceof AbstractMethodDeclaration) {
    AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
    parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
  } else if (referenceContext instanceof TypeDeclaration){
    // Local variable is declared inside an initializer
    TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
    JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
    parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
  }
  if (parent == null) return null;
  return new LocalVariable(
      parent,
      new String(local.name),
      local.declarationSourceStart,
      local.declarationSourceEnd,
      local.sourceStart,
      local.sourceEnd,
      Util.typeSignature(local.type),
      binding.declaration.annotations,
      local.modifiers,
      local.getKind() == AbstractVariableDeclaration.PARAMETER);
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

private JavaElement getJavaElement(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  JavaElement parent = null;
  ReferenceContext referenceContext = binding.declaringScope.referenceContext();
  if (referenceContext instanceof AbstractMethodDeclaration) {
    AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
    parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
  } else if (referenceContext instanceof TypeDeclaration){
    // Local variable is declared inside an initializer
    TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
    JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
    parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
  }
  if (parent == null) return null;
  return new LocalVariable(
      parent,
      new String(local.name),
      local.declarationSourceStart,
      local.declarationSourceEnd,
      local.sourceStart,
      local.sourceEnd,
      Util.typeSignature(local.type),
      binding.declaration.annotations,
      local.modifiers,
      local.getKind() == AbstractVariableDeclaration.PARAMETER);
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

private JavaElement getJavaElement(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  JavaElement parent = null;
  ReferenceContext referenceContext = binding.declaringScope.isLambdaSubscope() ? binding.declaringScope.namedMethodScope().referenceContext() : binding.declaringScope.referenceContext();
  if (referenceContext instanceof AbstractMethodDeclaration) {
    AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
    parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
  } else if (referenceContext instanceof TypeDeclaration){
    // Local variable is declared inside an initializer
    TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
    JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
    parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
  }
  if (parent == null) return null;
  return new LocalVariable(
      parent,
      new String(local.name),
      local.declarationSourceStart,
      local.declarationSourceEnd,
      local.sourceStart,
      local.sourceEnd,
      local.type == null ? Signature.createTypeSignature(binding.type.signableName(), true) : Util.typeSignature(local.type),
      binding.declaration.annotations,
      local.modifiers,
      local.getKind() == AbstractVariableDeclaration.PARAMETER);
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

private JavaElement getJavaElement(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  JavaElement parent = null;
  ReferenceContext referenceContext = binding.declaringScope.isLambdaSubscope() ? binding.declaringScope.namedMethodScope().referenceContext() : binding.declaringScope.referenceContext();
  if (referenceContext instanceof AbstractMethodDeclaration) {
    AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
    parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
  } else if (referenceContext instanceof TypeDeclaration){
    // Local variable is declared inside an initializer
    TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
    JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
    parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
  }
  if (parent == null) return null;
  return new LocalVariable(
      parent,
      new String(local.name),
      local.declarationSourceStart,
      local.declarationSourceEnd,
      local.sourceStart,
      local.sourceEnd,
      local.type == null ? Signature.createTypeSignature(binding.type.signableName(), true) : Util.typeSignature(local.type),
      binding.declaration.annotations,
      local.modifiers,
      local.getKind() == AbstractVariableDeclaration.PARAMETER);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

private JavaElement getJavaElement(LocalVariableBinding binding) {
  LocalDeclaration local = binding.declaration;
  JavaElement parent = null;
  ReferenceContext referenceContext = binding.declaringScope.isLambdaSubscope() ? binding.declaringScope.namedMethodScope().referenceContext() : binding.declaringScope.referenceContext();
  if (referenceContext instanceof AbstractMethodDeclaration) {
    AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
    parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
  } else if (referenceContext instanceof TypeDeclaration){
    // Local variable is declared inside an initializer
    TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
    JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
    parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
  }
  if (parent == null) return null;
  return new LocalVariable(
      parent,
      new String(local.name),
      local.declarationSourceStart,
      local.declarationSourceEnd,
      local.sourceStart,
      local.sourceEnd,
      local.type == null ? Signature.createTypeSignature(binding.type.signableName(), true) : Util.typeSignature(local.type),
      binding.declaration.annotations,
      local.modifiers,
      local.getKind() == AbstractVariableDeclaration.PARAMETER);
}

相关文章

Util类方法