本文整理了Java中org.eclipse.jdt.core.Signature.getTypeArguments()
方法的一些代码示例,展示了Signature.getTypeArguments()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature.getTypeArguments()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.Signature
类名称:Signature
方法名:getTypeArguments
[英]Extracts the type argument signatures from the given type signature. Returns an empty array if the type signature is not a parameterized type signature.
[中]从给定的类型签名中提取类型参数签名。如果类型签名不是参数化类型签名,则返回空数组。
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Returns the type variable signatures of the specified parameterized type signature, or an empty array if none.
*
* @param signature
* the signature to get its type variable signatures from. The signature must be a parameterized type signature.
* @return a possibly empty array of type variable signatures
* @see Signature#getTypeArguments(String)
*/
private static String[] getVariableSignatures(final String signature) {
Assert.isNotNull(signature);
String[] result= null;
try {
result= Signature.getTypeArguments(signature);
} catch (IllegalArgumentException exception) {
result= new String[0];
}
return result;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Returns the type variable signatures of the specified parameterized type signature, or an empty array if none.
*
* @param signature
* the signature to get its type variable signatures from. The signature must be a parameterized type signature.
* @return a possibly empty array of type variable signatures
* @see Signature#getTypeArguments(String)
*/
private static String[] getVariableSignatures(final String signature) {
Assert.isNotNull(signature);
String[] result= null;
try {
result= Signature.getTypeArguments(signature);
} catch (IllegalArgumentException exception) {
result= new String[0];
}
return result;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Returns the type variable signatures of the specified parameterized type signature, or an empty array if none.
*
* @param signature
* the signature to get its type variable signatures from. The signature must be a parameterized type signature.
* @return a possibly empty array of type variable signatures
* @see Signature#getTypeArguments(String)
*/
private static String[] getVariableSignatures(final String signature) {
Assert.isNotNull(signature);
String[] result= null;
try {
result= Signature.getTypeArguments(signature);
} catch (IllegalArgumentException exception) {
result= new String[0];
}
return result;
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
static int findMatchingTypeArgumentIndex(String signature, String argument) {
String[] typeArguments= Signature.getTypeArguments(signature);
for (int i= 0; i < typeArguments.length; i++) {
if (Signature.getSignatureSimpleName(typeArguments[i]).equals(argument)) {
return i;
}
}
return -1;
}
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
/**
* Extracts the type argument signatures from the given type signature.
* Returns an empty array if the type signature is not a parameterized type signature.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signatures of the type arguments
* @exception IllegalArgumentException if the signature is syntactically incorrect
*
* @since 3.1
*/
public static String[] getTypeArguments(String parameterizedTypeSignature) throws IllegalArgumentException {
char[][] args = getTypeArguments(parameterizedTypeSignature.toCharArray());
return CharOperation.toStrings(args);
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
/**
* Extracts the type argument signatures from the given type signature.
* Returns an empty array if the type signature is not a parameterized type signature.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signatures of the type arguments
* @exception IllegalArgumentException if the signature is syntactically incorrect
*
* @since 3.1
*/
public static String[] getTypeArguments(String parameterizedTypeSignature) throws IllegalArgumentException {
char[][] args = getTypeArguments(parameterizedTypeSignature.toCharArray());
return CharOperation.toStrings(args);
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
/**
* Extracts the type argument signatures from the given type signature.
* Returns an empty array if the type signature is not a parameterized type signature.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signatures of the type arguments
* @exception IllegalArgumentException if the signature is syntactically incorrect
*
* @since 3.1
*/
public static String[] getTypeArguments(String parameterizedTypeSignature) throws IllegalArgumentException {
char[][] args = getTypeArguments(parameterizedTypeSignature.toCharArray());
return CharOperation.toStrings(args);
}
/**
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Extracts the type argument signatures from the given type signature.
* Returns an empty array if the type signature is not a parameterized type signature.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signatures of the type arguments
* @exception IllegalArgumentException if the signature is syntactically incorrect
*
* @since 3.1
*/
public static String[] getTypeArguments(String parameterizedTypeSignature) throws IllegalArgumentException {
char[][] args = getTypeArguments(parameterizedTypeSignature.toCharArray());
return CharOperation.toStrings(args);
}
/**
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Extracts the type argument signatures from the given type signature.
* Returns an empty array if the type signature is not a parameterized type signature.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signatures of the type arguments
* @exception IllegalArgumentException if the signature is syntactically incorrect
*
* @since 3.1
*/
public static String[] getTypeArguments(String parameterizedTypeSignature) throws IllegalArgumentException {
char[][] args = getTypeArguments(parameterizedTypeSignature.toCharArray());
return CharOperation.toStrings(args);
}
/**
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
/**
* Extracts the type argument signatures from the given type signature.
* Returns an empty array if the type signature is not a parameterized type signature.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signatures of the type arguments
* @exception IllegalArgumentException if the signature is syntactically incorrect
*
* @since 3.1
*/
public static String[] getTypeArguments(String parameterizedTypeSignature) throws IllegalArgumentException {
char[][] args = getTypeArguments(parameterizedTypeSignature.toCharArray());
return CharOperation.toStrings(args);
}
/**
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee
private void getImportStatements(String signature, IType declaringType) throws JavaModelException{
String erasure = Signature.getTypeErasure(signature);
String resolvedTypeName = JavaModelUtil.getResolvedTypeName(erasure, declaringType);
if (resolvedTypeName != null && !importStatements.contains(resolvedTypeName) && !resolvedTypeName.startsWith("java.lang")) { //$NON-NLS-1$
importStatements.add(resolvedTypeName);
}
String [] params = Signature.getTypeArguments(signature);
for(int i=0;i<params.length; i++){
getImportStatements(params[i], declaringType);
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Extracts the type variables from a signature
*
* @param signature
* the signature to extract the type variables from
* @param variables
* the set of variables to fill in
*/
private static void extractTypeVariables(final String signature, final Set<String> variables) {
Assert.isNotNull(signature);
Assert.isNotNull(variables);
final String[] arguments= Signature.getTypeArguments(signature);
if (arguments.length == 0) {
variables.add(Signature.toString(signature));
} else {
for (int index= 0; index < arguments.length; index++)
variables.add(Signature.toString(arguments[index]));
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Extracts the type variables from a signature
*
* @param signature
* the signature to extract the type variables from
* @param variables
* the set of variables to fill in
*/
private static void extractTypeVariables(final String signature, final Set variables) {
Assert.isNotNull(signature);
Assert.isNotNull(variables);
final String[] arguments= Signature.getTypeArguments(signature);
if (arguments.length == 0) {
variables.add(Signature.toString(signature));
} else {
for (int index= 0; index < arguments.length; index++)
variables.add(Signature.toString(arguments[index]));
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Extracts the type variables from a signature
*
* @param signature
* the signature to extract the type variables from
* @param variables
* the set of variables to fill in
*/
private static void extractTypeVariables(final String signature, final Set<String> variables) {
Assert.isNotNull(signature);
Assert.isNotNull(variables);
final String[] arguments= Signature.getTypeArguments(signature);
if (arguments.length == 0) {
variables.add(Signature.toString(signature));
} else {
for (int index= 0; index < arguments.length; index++)
variables.add(Signature.toString(arguments[index]));
}
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
/**
* Appends the type parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param typeProposal the type proposal
* @return the modified <code>buffer</code>
*/
private StringBuilder appendTypeParameterList(StringBuilder buffer, CompletionProposal typeProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(typeProposal.getSignature());
char[][] typeParameters= Signature.getTypeArguments(signature);
for (int i= 0; i < typeParameters.length; i++) {
char[] param= typeParameters[i];
typeParameters[i]= Signature.toCharArray(param);
}
return appendParameterSignature(buffer, typeParameters, null);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
protected IContextInformation computeContextInformation() {
char[] signature= fProposal.getSignature();
char[][] typeParameters= Signature.getTypeArguments(signature);
if (typeParameters.length == 0)
return super.computeContextInformation();
ProposalContextInformation contextInformation= new ProposalContextInformation(fProposal);
if (fContextInformationPosition != 0 && fProposal.getCompletion().length == 0)
contextInformation.setContextInformationPosition(fContextInformationPosition);
return contextInformation;
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
protected IContextInformation computeContextInformation() {
char[] signature= fProposal.getSignature();
char[][] typeParameters= Signature.getTypeArguments(signature);
if (typeParameters.length == 0)
return super.computeContextInformation();
ProposalContextInformation contextInformation= new ProposalContextInformation(fProposal);
if (fContextInformationPosition != 0 && fProposal.getCompletion().length == 0)
contextInformation.setContextInformationPosition(fContextInformationPosition);
return contextInformation;
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Appends the type parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param typeProposal the type proposal
* @return the modified <code>buffer</code>
* @since 3.2
*/
private StringBuffer appendTypeParameterList(StringBuffer buffer, CompletionProposal typeProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(typeProposal.getSignature());
char[][] typeParameters= Signature.getTypeArguments(signature);
for (int i= 0; i < typeParameters.length; i++) {
char[] param= typeParameters[i];
typeParameters[i]= Signature.toCharArray(param);
}
return appendParameterSignature(buffer, typeParameters, null);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
@Override
protected IContextInformation computeContextInformation() {
char[] signature= fProposal.getSignature();
char[][] typeParameters= Signature.getTypeArguments(signature);
if (typeParameters.length == 0)
return super.computeContextInformation();
ProposalContextInformation contextInformation= new ProposalContextInformation(fProposal);
if (fContextInformationPosition != 0 && fProposal.getCompletion().length == 0)
contextInformation.setContextInformationPosition(fContextInformationPosition);
return contextInformation;
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Appends the type parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param typeProposal the type proposal
* @return the modified <code>buffer</code>
* @since 3.2
*/
private StyledString appendTypeParameterList(StyledString buffer, CompletionProposal typeProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(typeProposal.getSignature());
char[][] typeParameters= Signature.getTypeArguments(signature);
for (int i= 0; i < typeParameters.length; i++) {
char[] param= typeParameters[i];
typeParameters[i]= Signature.toCharArray(param);
}
return appendParameterSignature(buffer, typeParameters, null);
}
内容来源于网络,如有侵权,请联系作者删除!