本文整理了Java中org.eclipse.jdt.core.Signature.getArrayCount()
方法的一些代码示例,展示了Signature.getArrayCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature.getArrayCount()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.Signature
类名称:Signature
方法名:getArrayCount
[英]Returns the array count (array nesting depth) of the given type signature.
[中]返回给定类型签名的数组计数(数组嵌套深度)。
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns the array count (array nesting depth) of the given type signature.
*
* @param typeSignature the type signature
* @return the array nesting depth, or 0 if not an array
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
return getArrayCount(typeSignature.toCharArray());
}
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
/**
* Returns the array count (array nesting depth) of the given type signature.
*
* @param typeSignature the type signature
* @return the array nesting depth, or 0 if not an array
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
return getArrayCount(typeSignature.toCharArray());
}
/**
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns the array count (array nesting depth) of the given type signature.
*
* @param typeSignature the type signature
* @return the array nesting depth, or 0 if not an array
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
return getArrayCount(typeSignature.toCharArray());
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Returns the array count (array nesting depth) of the given type signature.
*
* @param typeSignature the type signature
* @return the array nesting depth, or 0 if not an array
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
return getArrayCount(typeSignature.toCharArray());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
/**
* Returns the array count (array nesting depth) of the given type signature.
*
* @param typeSignature the type signature
* @return the array nesting depth, or 0 if not an array
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
return getArrayCount(typeSignature.toCharArray());
}
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
/**
* Returns the array count (array nesting depth) of the given type signature.
*
* @param typeSignature the type signature
* @return the array nesting depth, or 0 if not an array
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
return getArrayCount(typeSignature.toCharArray());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns the type signature without any array nesting.
* <p>
* For example:
* <pre>
* <code>
* getElementType({'[', '[', 'I'}) --> {'I'}.
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the type signature without arrays
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*
* @since 2.0
*/
public static char[] getElementType(char[] typeSignature) throws IllegalArgumentException {
int count = getArrayCount(typeSignature);
if (count == 0) return typeSignature;
int length = typeSignature.length;
char[] result = new char[length-count];
System.arraycopy(typeSignature, count, result, 0, length-count);
return result;
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Returns the type signature without any array nesting.
* <p>
* For example:
* <pre>
* <code>
* getElementType({'[', '[', 'I'}) --> {'I'}.
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the type signature without arrays
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*
* @since 2.0
*/
public static char[] getElementType(char[] typeSignature) throws IllegalArgumentException {
int count = getArrayCount(typeSignature);
if (count == 0) return typeSignature;
int length = typeSignature.length;
char[] result = new char[length-count];
System.arraycopy(typeSignature, count, result, 0, length-count);
return result;
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns the type signature without any array nesting.
* <p>
* For example:
* <pre>
* <code>
* getElementType({'[', '[', 'I'}) --> {'I'}.
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the type signature without arrays
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*
* @since 2.0
*/
public static char[] getElementType(char[] typeSignature) throws IllegalArgumentException {
int count = getArrayCount(typeSignature);
if (count == 0) return typeSignature;
int length = typeSignature.length;
char[] result = new char[length-count];
System.arraycopy(typeSignature, count, result, 0, length-count);
return result;
}
代码示例来源:origin: eclipse/eclemma
private static final void resolveArrayParameterType(final IMethod method,
final String parameterType, final StringBuilder result)
throws JavaModelException {
final int arrayCount = Signature.getArrayCount(parameterType);
for (int i = 0; i < arrayCount; i++) {
result.append(Signature.C_ARRAY);
}
resolveParameterType(method, parameterType.substring(arrayCount), result);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private static boolean isArray(IField field) throws JavaModelException {
return Signature.getArrayCount(field.getTypeSignature()) > 0;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private static boolean isArray(IField field) throws JavaModelException {
return Signature.getArrayCount(field.getTypeSignature()) > 0;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private static boolean isArray(IField field) throws JavaModelException {
return Signature.getArrayCount(field.getTypeSignature()) > 0;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Returns the type names of all member type bounds, as they would be
* appear when referenced in the current compilation unit.
*
* @return type names of all member type bounds
*/
public String[] getMemberTypeNames() {
String[] signatures= getMemberTypeSignatures();
String[] names= new String[signatures.length];
for (int i= 0; i < signatures.length; i++) {
String sig= signatures[i];
String local= (String) fLocalTypes.get(Signature.getElementType(sig));
int dim= Signature.getArrayCount(sig);
if (local != null && dim > 0) {
StringBuffer array= new StringBuffer(local);
for (int j= 0; j < dim; j++)
array.append("[]"); //$NON-NLS-1$
local= array.toString();
}
if (local != null)
names[i]= local;
else
names[i]= Signature.getSimpleName(Signature.getSignatureSimpleName(sig));
}
return names;
}
代码示例来源:origin: org.eclipse.recommenders.completion.rcp/calls
public ProposalMatcher(CompletionProposal proposal) {
jSignature = getSignature(proposal);
jName = valueOf(proposal.getName());
jParams = getParameterTypes(jSignature);
for (int i = 0; i < jParams.length; i++) {
String param = getTypeErasure(jParams[i]);
String paramBaseType = getElementType(param);
param = param.replace('.', '/');
param = StringUtils.removeEnd(param, ";");
if (isWildcardCapture(paramBaseType) || isTypeParameter(paramBaseType)) {
int dimensions = getArrayCount(param);
param = StringUtils.repeat('[', dimensions) + "Ljava/lang/Object";
}
jParams[i] = param;
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.jsf.core
protected SignatureBasedType handlePerformObjectSymbolValue(
IObjectSymbolBasedValueType firstArg, ValueType secondArg)
{
// per JSP.2.3.4 step 5.2, if value-a is a list or array access
if (firstArg.isInstanceOf(TypeConstants.TYPE_LIST)
|| Signature.getArrayCount(firstArg.getSignature()) > 0)
{
return handlePerformNumericPropertyAccessorBase(firstArg, secondArg);
}
// per JSP.2.3.4 step 5, if value-a is a map or if it is not
// a list or array (and therefore a bean), treat it as named property accessed object
// if firstArg is a map then we must treat the access like a map.get(secondArg)
// if we don't have a literal value with which to derive value-b, then
// we can't get a property
if (secondArg instanceof LiteralType)
{
return handlePerformNamedPropertyAccessorBase(firstArg, (LiteralType)secondArg);
}
return null;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private static List createParameterInfoList(IMethod method) {
try {
String[] typeNames= method.getParameterTypes();
String[] oldNames= method.getParameterNames();
List result= new ArrayList(typeNames.length);
for (int i= 0; i < oldNames.length; i++){
ParameterInfo parameterInfo;
if (i == oldNames.length - 1 && Flags.isVarargs(method.getFlags())) {
String varargSignature= typeNames[i];
int arrayCount= Signature.getArrayCount(varargSignature);
String baseSignature= Signature.getElementType(varargSignature);
if (arrayCount > 1)
baseSignature= Signature.createArraySignature(baseSignature, arrayCount - 1);
parameterInfo= new ParameterInfo(Signature.toString(baseSignature) + ParameterInfo.ELLIPSIS, oldNames[i], i);
} else {
parameterInfo= new ParameterInfo(Signature.toString(typeNames[i]), oldNames[i], i);
}
result.add(parameterInfo);
}
return result;
} catch(JavaModelException e) {
JavaPlugin.log(e);
return new ArrayList(0);
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private static List<ParameterInfo> createParameterInfoList(IMethod method) {
try {
String[] typeNames= method.getParameterTypes();
String[] oldNames= method.getParameterNames();
List<ParameterInfo> result= new ArrayList<>(typeNames.length);
for (int i= 0; i < oldNames.length; i++){
ParameterInfo parameterInfo;
if (i == oldNames.length - 1 && Flags.isVarargs(method.getFlags())) {
String varargSignature= typeNames[i];
int arrayCount= Signature.getArrayCount(varargSignature);
String baseSignature= Signature.getElementType(varargSignature);
if (arrayCount > 1)
baseSignature= Signature.createArraySignature(baseSignature, arrayCount - 1);
parameterInfo= new ParameterInfo(Signature.toString(baseSignature) + ParameterInfo.ELLIPSIS, oldNames[i], i);
} else {
parameterInfo= new ParameterInfo(Signature.toString(typeNames[i]), oldNames[i], i);
}
result.add(parameterInfo);
}
return result;
} catch(JavaModelException e) {
JavaPlugin.log(e);
return new ArrayList<>(0);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private static List<ParameterInfo> createParameterInfoList(IMethod method) {
try {
String[] typeNames= method.getParameterTypes();
String[] oldNames= method.getParameterNames();
List<ParameterInfo> result= new ArrayList<>(typeNames.length);
for (int i= 0; i < oldNames.length; i++){
ParameterInfo parameterInfo;
if (i == oldNames.length - 1 && Flags.isVarargs(method.getFlags())) {
String varargSignature= typeNames[i];
int arrayCount= Signature.getArrayCount(varargSignature);
String baseSignature= Signature.getElementType(varargSignature);
if (arrayCount > 1)
baseSignature= Signature.createArraySignature(baseSignature, arrayCount - 1);
parameterInfo= new ParameterInfo(Signature.toString(baseSignature) + ParameterInfo.ELLIPSIS, oldNames[i], i);
} else {
parameterInfo= new ParameterInfo(Signature.toString(typeNames[i]), oldNames[i], i);
}
result.add(parameterInfo);
}
return result;
} catch(JavaModelException e) {
JavaPlugin.log(e);
return new ArrayList<>(0);
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
return new String[] {Signature.createArraySignature(Signature.getElementType(signature), Signature.getArrayCount(signature) - 1)};
} else if (fUnit != null && (isIterable() || isCollection())) {
if (fMemberTypes == null) {
内容来源于网络,如有侵权,请联系作者删除!