org.eclipse.jdt.core.Signature.getReturnType()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(143)

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

Signature.getReturnType介绍

[英]Extracts the return type from the given method signature. The method signature is expected to be dot-based.
[中]从给定的方法签名中提取返回类型。方法签名预计是基于点的。

代码示例

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 */
public static String getReturnType(String methodSignature) throws IllegalArgumentException {
  return new String(getReturnType(methodSignature.toCharArray()));
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 */
public static String getReturnType(String methodSignature) throws IllegalArgumentException {
  return new String(getReturnType(methodSignature.toCharArray()));
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 */
public static String getReturnType(String methodSignature) throws IllegalArgumentException {
  return new String(getReturnType(methodSignature.toCharArray()));
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 */
public static String getReturnType(String methodSignature) throws IllegalArgumentException {
  return new String(getReturnType(methodSignature.toCharArray()));
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 */
public static String getReturnType(String methodSignature) throws IllegalArgumentException {
  return new String(getReturnType(methodSignature.toCharArray()));
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 */
public static String getReturnType(String methodSignature) throws IllegalArgumentException {
  return new String(getReturnType(methodSignature.toCharArray()));
}
/**

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

private String getReturnType(IBinaryMethod info) {
  char[] genericSignature = info.getGenericSignature();
  char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature;
  char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.');
  String returnTypeName= Signature.getReturnType(new String(dotBasedSignature));
  return new String(ClassFile.translatedName(returnTypeName.toCharArray()));
}
/*

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

private String getReturnType(IBinaryMethod info) {
  char[] genericSignature = info.getGenericSignature();
  char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature;
  char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.');
  String returnTypeName= Signature.getReturnType(new String(dotBasedSignature));
  return new String(ClassFile.translatedName(returnTypeName.toCharArray()));
}
/*

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

private String getReturnType(IBinaryMethod info) {
  char[] genericSignature = info.getGenericSignature();
  char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature;
  char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.');
  String returnTypeName= Signature.getReturnType(new String(dotBasedSignature));
  return new String(ClassFile.translatedName(returnTypeName.toCharArray()));
}
/*

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

private String getReturnType(IBinaryMethod info) {
  char[] genericSignature = info.getGenericSignature();
  char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature;
  char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.');
  String returnTypeName= Signature.getReturnType(new String(dotBasedSignature));
  return new String(ClassFile.translatedName(returnTypeName.toCharArray()));
}
/*

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

private String getReturnType(IBinaryMethod info) {
  char[] genericSignature = info.getGenericSignature();
  char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature;
  char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.');
  String returnTypeName= Signature.getReturnType(new String(dotBasedSignature));
  return new String(ClassFile.translatedName(returnTypeName.toCharArray()));
}
/*

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

private String getReturnType(IBinaryMethod info) {
  char[] genericSignature = info.getGenericSignature();
  char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature;
  char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.');
  String returnTypeName= Signature.getReturnType(new String(dotBasedSignature));
  return new String(ClassFile.translatedName(returnTypeName.toCharArray()));
}
/*

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

/**
 * Returns whether we automatically complete the method with a semicolon.
 * 
 * @return <code>true</code> if the return type of the method is void, <code>false</code>
 *         otherwise
 * @since 3.9
 */
protected final boolean canAutomaticallyAppendSemicolon() {
  return !fProposal.isConstructor() && CharOperation.equals(new char[] { Signature.C_VOID }, Signature.getReturnType(fProposal.getSignature()));
}

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

/**
 * Returns whether we automatically complete the method with a semicolon.
 * 
 * @return <code>true</code> if the return type of the method is void, <code>false</code>
 *         otherwise
 * @since 3.9
 */
protected final boolean canAutomaticallyAppendSemicolon() {
  return !fProposal.isConstructor() && CharOperation.equals(new char[] { Signature.C_VOID }, Signature.getReturnType(fProposal.getSignature()));
}

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

private final boolean canAutomaticallyAppendSemicolon(CompletionProposal proposal) {
  return !proposal.isConstructor() && CharOperation.equals(new char[] { Signature.C_VOID }, Signature.getReturnType(proposal.getSignature()));
}

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

String createOverrideMethodProposalLabel(CompletionProposal methodProposal) {
  StringBuffer nameBuffer= new StringBuffer();
  // method name
  nameBuffer.append(methodProposal.getName());
  // parameters
  nameBuffer.append('(');
  appendUnboundedParameterList(nameBuffer, methodProposal);
  nameBuffer.append(")  "); //$NON-NLS-1$
  // return type
  // TODO remove SignatureUtil.fix83600 call when bugs are fixed
  char[] returnType= createTypeDisplayName(SignatureUtil.getUpperBound(Signature.getReturnType(SignatureUtil.fix83600(methodProposal.getSignature()))));
  nameBuffer.append(returnType);
  // declaring type
  nameBuffer.append(" - "); //$NON-NLS-1$
  String declaringType= extractDeclaringTypeFQN(methodProposal);
  declaringType= Signature.getSimpleName(declaringType);
  nameBuffer.append(Messages.format(JavaTextMessages.ResultCollector_overridingmethod, new String(declaringType)));
  return nameBuffer.toString();
}

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

protected void run() {		
  IJavaStackFrame stackFrame= getStackFrameContext();
  if (stackFrame != null) {
    try {
      String returnType = Signature.getReturnType(stackFrame.getSignature());
      if (Signature.SIG_VOID.equals(returnType)) {
        // no evaluation required for void methods
        stackFrame.forceReturn(((IJavaDebugTarget)stackFrame.getDebugTarget()).voidValue());
        return;
      }
    } catch (DebugException e) {
      JDIDebugUIPlugin.statusDialog(e.getStatus());
      return;
    }
  }
  fTargetFrame = stackFrame;
  // perform evaluation otherwise
  super.run();
}

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

/**
 * Creates a new change signature refactoring.
 * @param method the method, or <code>null</code> if invoked by scripting framework
 * @throws JavaModelException
 */
public ChangeSignatureRefactoring(IMethod method) throws JavaModelException {
  fMethod= method;
  fOldVarargIndex= -1;
  fDelegateUpdating= false;
  fDelegateDeprecation= true;
  if (fMethod != null) {
    fParameterInfos= createParameterInfoList(method);
    // fExceptionInfos is created in checkInitialConditions
    fReturnTypeInfo= new ReturnTypeInfo(Signature.toString(Signature.getReturnType(fMethod.getSignature())));
    fMethodName= fMethod.getElementName();
    fVisibility= JdtFlags.getVisibilityCode(fMethod);
  }
}

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

/**
 * Creates a new change signature refactoring.
 * @param method the method, or <code>null</code> if invoked by scripting framework
 * @throws JavaModelException if something's wrong with the given method
 */
public ChangeSignatureProcessor(IMethod method) throws JavaModelException {
  fMethod= method;
  fOldVarargIndex= -1;
  fDelegateUpdating= false;
  fDelegateDeprecation= true;
  if (fMethod != null) {
    fParameterInfos= createParameterInfoList(method);
    // fExceptionInfos is created in checkInitialConditions
    fReturnTypeInfo= new ReturnTypeInfo(Signature.toString(Signature.getReturnType(fMethod.getSignature())));
    fMethodName= fMethod.getElementName();
    fVisibility= JdtFlags.getVisibilityCode(fMethod);
  }
}

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

/**
 * Creates a new change signature refactoring.
 * @param method the method, or <code>null</code> if invoked by scripting framework
 * @throws JavaModelException if something's wrong with the given method
 */
public ChangeSignatureProcessor(IMethod method) throws JavaModelException {
  fMethod= method;
  fOldVarargIndex= -1;
  fDelegateUpdating= false;
  fDelegateDeprecation= true;
  if (fMethod != null) {
    fParameterInfos= createParameterInfoList(method);
    // fExceptionInfos is created in checkInitialConditions
    fReturnTypeInfo= new ReturnTypeInfo(Signature.toString(Signature.getReturnType(fMethod.getSignature())));
    fMethodName= fMethod.getElementName();
    fVisibility= JdtFlags.getVisibilityCode(fMethod);
  }
}

相关文章