本文整理了Java中org.eclipse.jdt.core.Signature.getSignatureQualifier()
方法的一些代码示例,展示了Signature.getSignatureQualifier()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature.getSignatureQualifier()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.Signature
类名称:Signature
方法名:getSignatureQualifier
[英]Returns package fragment of a type signature. The package fragment separator must be '.' and the type fragment separator must be '$'.
For example:
getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
[中]返回类型签名的包片段。包片段分隔符必须为“.”类型片段分隔符必须是“$”。
例如:
getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
/**
* Returns package fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the package fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureQualifier(String typeSignature) {
return new String(getSignatureQualifier(typeSignature == null ? null : typeSignature.toCharArray()));
}
/**
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
private char[][] getParameterPackages(char[] methodSignature) {
char[][] parameterQualifiedTypes = Signature.getParameterTypes(methodSignature);
int length = parameterQualifiedTypes == null ? 0 : parameterQualifiedTypes.length;
char[][] parameterPackages = new char[length][];
for(int i = 0; i < length; i++) {
parameterPackages[i] = Signature.getSignatureQualifier(parameterQualifiedTypes[i]);
}
return parameterPackages;
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Returns package fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the package fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureQualifier(String typeSignature) {
return new String(getSignatureQualifier(typeSignature == null ? null : typeSignature.toCharArray()));
}
/**
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
private char[][] getParameterPackages(char[] methodSignature) {
char[][] parameterQualifiedTypes = Signature.getParameterTypes(methodSignature);
int length = parameterQualifiedTypes == null ? 0 : parameterQualifiedTypes.length;
char[][] parameterPackages = new char[length][];
for(int i = 0; i < length; i++) {
parameterPackages[i] = Signature.getSignatureQualifier(parameterQualifiedTypes[i]);
}
return parameterPackages;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns package fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the package fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureQualifier(String typeSignature) {
return new String(getSignatureQualifier(typeSignature == null ? null : typeSignature.toCharArray()));
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
private char[][] getParameterPackages(char[] methodSignature) {
char[][] parameterQualifiedTypes = Signature.getParameterTypes(methodSignature);
int length = parameterQualifiedTypes == null ? 0 : parameterQualifiedTypes.length;
char[][] parameterPackages = new char[length][];
for(int i = 0; i < length; i++) {
parameterPackages[i] = Signature.getSignatureQualifier(parameterQualifiedTypes[i]);
}
return parameterPackages;
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
private char[][] getParameterPackages(char[] methodSignature) {
char[][] parameterQualifiedTypes = Signature.getParameterTypes(methodSignature);
int length = parameterQualifiedTypes == null ? 0 : parameterQualifiedTypes.length;
char[][] parameterPackages = new char[length][];
for(int i = 0; i < length; i++) {
parameterPackages[i] = Signature.getSignatureQualifier(parameterQualifiedTypes[i]);
}
return parameterPackages;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
/**
* Returns package fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the package fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureQualifier(String typeSignature) {
return new String(getSignatureQualifier(typeSignature == null ? null : typeSignature.toCharArray()));
}
/**
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns package fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the package fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureQualifier(String typeSignature) {
return new String(getSignatureQualifier(typeSignature == null ? null : typeSignature.toCharArray()));
}
/**
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
/**
* Returns package fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the package fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureQualifier(String typeSignature) {
return new String(getSignatureQualifier(typeSignature == null ? null : typeSignature.toCharArray()));
}
/**
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
private char[][] getParameterPackages(char[] methodSignature) {
char[][] parameterQualifiedTypes = Signature.getParameterTypes(methodSignature);
int length = parameterQualifiedTypes == null ? 0 : parameterQualifiedTypes.length;
char[][] parameterPackages = new char[length][];
for(int i = 0; i < length; i++) {
parameterPackages[i] = Signature.getSignatureQualifier(parameterQualifiedTypes[i]);
}
return parameterPackages;
}
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
private char[][] getParameterPackages(char[] methodSignature) {
char[][] parameterQualifiedTypes = Signature.getParameterTypes(methodSignature);
int length = parameterQualifiedTypes == null ? 0 : parameterQualifiedTypes.length;
char[][] parameterPackages = new char[length][];
for(int i = 0; i < length; i++) {
parameterPackages[i] = Signature.getSignatureQualifier(parameterQualifiedTypes[i]);
}
return parameterPackages;
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
protected final void addPackage(String typeSignature, Set<String> pkgs, IType type, boolean binary,
IProgressMonitor monitor) throws JavaModelException {
if (typeSignature == null)
return;
if (binary)
typeSignature = typeSignature.replace('/', '.');
// if typeSignature contains a '.', test to see if it is a subClass first. If not, assume it is a fully qualified name
if (typeSignature.indexOf('.') != -1) {
try {
String[][] temp = type.resolveType(new String(Signature.toCharArray(typeSignature.toCharArray())));
if (temp != null) {
pkgs.add(temp[0][0]);
return;
}
} catch (IllegalArgumentException e) {
}
String pkg = Signature.getSignatureQualifier(typeSignature);
if (pkg.length() > 0) {
pkgs.add(pkg);
return;
}
// if typeSignature does not contain a '.', then assume the package name is in an import statement and try to resolve through the type object
} else {
String typeName = Signature.getSignatureSimpleName(typeSignature);
String[][] result = type.resolveType(typeName);
if (result != null)
pkgs.add(result[0][0]);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private String[][] getParameterSignatures() {
char[] signature= SignatureUtil.fix83600(fProposal.getSignature());
char[][] types= Signature.getParameterTypes(signature);
String[][] ret= new String[types.length][2];
for (int i= 0; i < types.length; i++) {
char[] type= SignatureUtil.getLowerBound(types[i]);
ret[i][0]= String.valueOf(Signature.getSignatureQualifier(type));
ret[i][1]= String.valueOf(Signature.getSignatureSimpleName(type));
}
return ret;
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
private void createAnonymousTypeLabel(CompletionProposal proposal, CompletionItem item) {
char[] declaringTypeSignature= proposal.getDeclarationSignature();
declaringTypeSignature= Signature.getTypeErasure(declaringTypeSignature);
String name = new String(Signature.getSignatureSimpleName(declaringTypeSignature));
item.setInsertText(name);
StringBuilder buf= new StringBuilder();
buf.append(name);
buf.append('(');
appendUnboundedParameterList(buf, proposal);
buf.append(')');
buf.append(" "); //$NON-NLS-1$
buf.append("Anonymous Inner Type"); //TODO: consider externalization
item.setLabel(buf.toString());
if (proposal.getRequiredProposals() != null) {
char[] signatureQualifier= Signature.getSignatureQualifier(declaringTypeSignature);
if (signatureQualifier.length > 0) {
item.setDetail(String.valueOf(signatureQualifier));
}
}
setDeclarationSignature(item, String.valueOf(declaringTypeSignature));
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
return signature;
String qualifier= Signature.getSignatureQualifier(signature);
if (qualifier.length() > 0)
return signature;
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
StyledString createAnonymousTypeLabel(CompletionProposal proposal) {
char[] declaringTypeSignature= proposal.getDeclarationSignature();
declaringTypeSignature= Signature.getTypeErasure(declaringTypeSignature);
StyledString buffer= new StyledString();
buffer.append(Signature.getSignatureSimpleName(declaringTypeSignature));
buffer.append('(');
appendUnboundedParameterList(buffer, proposal);
buffer.append(')');
buffer.append(" "); //$NON-NLS-1$
buffer.append(JavaTextMessages.ResultCollector_anonymous_type);
if (proposal.getRequiredProposals() != null) {
char[] signatureQualifier= Signature.getSignatureQualifier(declaringTypeSignature);
if (signatureQualifier.length > 0) {
buffer.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER);
buffer.append(signatureQualifier, StyledString.QUALIFIER_STYLER);
}
}
return Strings.markJavaElementLabelLTR(buffer);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
StyledString createAnonymousTypeLabel(CompletionProposal proposal) {
char[] declaringTypeSignature= proposal.getDeclarationSignature();
declaringTypeSignature= Signature.getTypeErasure(declaringTypeSignature);
StyledString buffer= new StyledString();
buffer.append(Signature.getSignatureSimpleName(declaringTypeSignature));
buffer.append('(');
appendUnboundedParameterList(buffer, proposal);
buffer.append(')');
buffer.append(" "); //$NON-NLS-1$
buffer.append(JavaTextMessages.ResultCollector_anonymous_type);
if (proposal.getRequiredProposals() != null) {
char[] signatureQualifier= Signature.getSignatureQualifier(declaringTypeSignature);
if (signatureQualifier.length > 0) {
buffer.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER);
buffer.append(signatureQualifier, StyledString.QUALIFIER_STYLER);
}
}
return Strings.markJavaElementLabelLTR(buffer);
}
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
public void accept(CompletionProposal proposal) {
switch(proposal.getKind()) {
case CompletionProposal.TYPE_REF:
int flags = proposal.getFlags();
if((flags & Flags.AccEnum) == 0 &&
(flags & Flags.AccInterface) == 0) {
// Remove completion on generated class name or generated global variable class name
char[] packageName = proposal.getDeclarationSignature();
char[] className = Signature.getSignatureSimpleName(proposal.getSignature());
if (CharOperation.equals(packageName, CodeSnippetToCuMapper.this.snippetPackageName)
&& (CharOperation.equals(className, CodeSnippetToCuMapper.this.snippetClassName)
|| CharOperation.equals(className, CodeSnippetToCuMapper.this.snippetVarClassName))) return;
if (CharOperation.equals(packageName, PACKAGE_NAME)
&& CharOperation.equals(className, ROOT_CLASS_NAME)) return;
}
break;
case CompletionProposal.METHOD_REF:
case CompletionProposal.METHOD_DECLARATION:
case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
// Remove completion on generated method
char[] declaringTypePackageName = Signature.getSignatureQualifier(proposal.getDeclarationSignature());
char[] declaringTypeName = Signature.getSignatureSimpleName(proposal.getDeclarationSignature());
if (CharOperation.equals(declaringTypePackageName, CodeSnippetToCuMapper.this.snippetPackageName)
&& CharOperation.equals(declaringTypeName, CodeSnippetToCuMapper.this.snippetClassName)) return;
if (CharOperation.equals(declaringTypePackageName, PACKAGE_NAME)
&& CharOperation.equals(declaringTypeName, ROOT_CLASS_NAME)) return;
break;
}
originalRequestor.accept(proposal);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
char[] declaringTypePackageName = Signature.getSignatureQualifier(proposal.getDeclarationSignature());
char[] declaringTypeName = Signature.getSignatureSimpleName(proposal.getDeclarationSignature());
内容来源于网络,如有侵权,请联系作者删除!