本文整理汇总了Java中org.eclipse.jdt.core.Flags.isVarargs方法的典型用法代码示例。如果您正苦于以下问题:Java Flags.isVarargs方法的具体用法?Java Flags.isVarargs怎么用?Java Flags.isVarargs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.Flags
的用法示例。
在下文中一共展示了Flags.isVarargs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendUnboundedParameterList
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
* Appends the parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param methodProposal the method proposal
* @return the modified <code>buffer</code>
*/
private StringBuilder appendUnboundedParameterList(StringBuilder buffer, CompletionProposal methodProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames= methodProposal.findParameterNames(null);
char[][] parameterTypes= Signature.getParameterTypes(signature);
for (int i= 0; i < parameterTypes.length; i++) {
parameterTypes[i]= createTypeDisplayName(SignatureUtil.getLowerBound(parameterTypes[i]));
}
if (Flags.isVarargs(methodProposal.getFlags())) {
int index= parameterTypes.length - 1;
parameterTypes[index]= convertToVararg(parameterTypes[index]);
}
return appendParameterSignature(buffer, parameterTypes, parameterNames);
}
示例2: appendUnboundedParameterList
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
* Appends the parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param methodProposal the method proposal
* @return the modified <code>buffer</code>
*/
private StyledString appendUnboundedParameterList(
StyledString buffer, CompletionProposal methodProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature = SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames = methodProposal.findParameterNames(null);
char[][] parameterTypes = Signature.getParameterTypes(signature);
for (int i = 0; i < parameterTypes.length; i++)
parameterTypes[i] = createTypeDisplayName(SignatureUtil.getLowerBound(parameterTypes[i]));
if (Flags.isVarargs(methodProposal.getFlags())) {
int index = parameterTypes.length - 1;
parameterTypes[index] = convertToVararg(parameterTypes[index]);
}
return appendParameterSignature(buffer, parameterTypes, parameterNames);
}
示例3: toSignatureInformation
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public SignatureInformation toSignatureInformation(CompletionProposal methodProposal) {
SignatureInformation $ = new SignatureInformation();
StringBuilder desription = descriptionProvider.createMethodProposalDescription(methodProposal);
$.setLabel(desription.toString());
$.setDocumentation(this.computeJavaDoc(methodProposal));
char[] signature = SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames = methodProposal.findParameterNames(null);
char[][] parameterTypes = Signature.getParameterTypes(signature);
for (int i = 0; i < parameterTypes.length; i++) {
parameterTypes[i] = Signature.getSimpleName(Signature.toCharArray(SignatureUtil.getLowerBound(parameterTypes[i])));
}
if (Flags.isVarargs(methodProposal.getFlags())) {
int index = parameterTypes.length - 1;
parameterTypes[index] = convertToVararg(parameterTypes[index]);
}
List<ParameterInformation> parameterInfos = new LinkedList<>();
for (int i = 0; i < parameterTypes.length; i++) {
StringBuilder builder = new StringBuilder();
builder.append(parameterTypes[i]);
builder.append(' ');
builder.append(parameterNames[i]);
parameterInfos.add(new ParameterInformation(builder.toString(), null));
}
$.setParameters(parameterInfos);
return $;
}
示例4: isVarargs
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public static boolean isVarargs(IMethod method) throws JavaModelException {
return Flags.isVarargs(method.getFlags());
}
示例5: appendMethodReference
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static void appendMethodReference(IMethod meth, StringBuffer buf)
throws JavaModelException {
buf.append(meth.getElementName());
/*
* The Javadoc tool for Java SE 8 changed the anchor syntax and now tries to avoid "strange" characters in URLs.
* This breaks all clients that directly create such URLs.
* We can't know what format is required, so we just guess by the project's compiler compliance.
*/
boolean is18OrHigher = JavaModelUtil.is18OrHigher(meth.getJavaProject());
buf.append(is18OrHigher ? '-' : '(');
String[] params = meth.getParameterTypes();
IType declaringType = meth.getDeclaringType();
boolean isVararg = Flags.isVarargs(meth.getFlags());
int lastParam = params.length - 1;
for (int i = 0; i <= lastParam; i++) {
if (i != 0) {
buf.append(is18OrHigher ? "-" : ", "); // $NON-NLS-1$ //$NON-NLS-2$
}
String curr = Signature.getTypeErasure(params[i]);
String fullName = JavaModelUtil.getResolvedTypeName(curr, declaringType);
if (fullName == null) { // e.g. a type parameter "QE;"
fullName = Signature.toString(Signature.getElementType(curr));
}
if (fullName != null) {
buf.append(fullName);
int dim = Signature.getArrayCount(curr);
if (i == lastParam && isVararg) {
dim--;
}
while (dim > 0) {
buf.append(is18OrHigher ? ":A" : "[]"); // $NON-NLS-1$ //$NON-NLS-2$
dim--;
}
if (i == lastParam && isVararg) {
buf.append("..."); // $NON-NLS-1$
}
}
}
buf.append(is18OrHigher ? '-' : ')');
}