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

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

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

Signature.createTypeSignature介绍

[英]Creates a new type signature from the given type name. If the type name is qualified, then it is expected to be dot-based. The type name may contain primitive types or array types. However, parameterized types are not supported.

For example:

createTypeSignature("int", hucairz) -> "I" 
createTypeSignature("java.lang.String", true) -> "Ljava.lang.String;" 
createTypeSignature("String", false) -> "QString;" 
createTypeSignature("java.lang.String", false) -> "Qjava.lang.String;" 
createTypeSignature("int []", false) -> "[I"

[中]根据给定的类型名创建新的类型签名。如果类型名是限定的,那么它应该是基于点的。类型名称可以包含基元类型或数组类型。但是,不支持参数化类型。
例如:

createTypeSignature("int", hucairz) -> "I" 
createTypeSignature("java.lang.String", true) -> "Ljava.lang.String;" 
createTypeSignature("String", false) -> "QString;" 
createTypeSignature("java.lang.String", false) -> "Qjava.lang.String;" 
createTypeSignature("int []", false) -> "[I"

代码示例

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

/**
 * Returns the type signature of the field.
 *
 * @see Signature
 */
protected String getTypeSignature() {
  return Signature.createTypeSignature(this.typeName, false);
}

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

/**
 * Returns the type signature of the field.
 *
 * @see Signature
 */
protected String getTypeSignature() {
  return Signature.createTypeSignature(this.typeName, false);
}

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

/**
 * Returns the type signature of the field.
 *
 * @see Signature
 */
protected String getTypeSignature() {
  return Signature.createTypeSignature(this.typeName, false);
}

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

/**
 * Returns the type signature of the field.
 *
 * @see Signature
 */
protected String getTypeSignature() {
  return Signature.createTypeSignature(this.typeName, false);
}

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

public static String getSignature(Type type) {
  StringBuffer buffer = new StringBuffer();
  getFullyQualifiedName(type, buffer);
  return Signature.createTypeSignature(buffer.toString(), false/*not resolved in source*/);
}

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

public static String getSignature(Type type) {
  StringBuffer buffer = new StringBuffer();
  getFullyQualifiedName(type, buffer);
  return Signature.createTypeSignature(buffer.toString(), false/*not resolved in source*/);
}

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

public static String getSignature(Type type) {
  StringBuffer buffer = new StringBuffer();
  getFullyQualifiedName(type, buffer);
  return Signature.createTypeSignature(buffer.toString(), false/*not resolved in source*/);
}

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

/**
 * @see IType#getSuperclassTypeSignature()
 * @since 3.0
 */
public String getSuperclassTypeSignature() throws JavaModelException {
  SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
  char[] superclassName= info.getSuperclassName();
  if (superclassName == null) {
    return null;
  }
  return new String(Signature.createTypeSignature(superclassName, false));
}

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

/**
 * @see IType#getSuperclassTypeSignature()
 * @since 3.0
 */
public String getSuperclassTypeSignature() throws JavaModelException {
  SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
  char[] superclassName= info.getSuperclassName();
  if (superclassName == null) {
    return null;
  }
  return new String(Signature.createTypeSignature(superclassName, false));
}

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

/**
 * @see IType#getSuperclassTypeSignature()
 * @since 3.0
 */
public String getSuperclassTypeSignature() throws JavaModelException {
  SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
  char[] superclassName= info.getSuperclassName();
  if (superclassName == null) {
    return null;
  }
  return new String(Signature.createTypeSignature(superclassName, false));
}

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

private String getTypeParameterErasure(ITypeParameter typeParameter, IType context) throws JavaModelException {
  String[] bounds= typeParameter.getBounds();
  if (bounds.length > 0) {
    return getSubstitutedTypeName(Signature.createTypeSignature(bounds[0], false), context);
  }
  return "Object"; //$NON-NLS-1$
}

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

/**
 * @see IMethod
 */
public String getReturnType() throws JavaModelException {
  SourceMethodElementInfo info = (SourceMethodElementInfo) getElementInfo();
  return Signature.createTypeSignature(info.getReturnTypeName(), false);
}
/**

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

private static String[] typeSignatures(TypeReference[] types) {
  int length = types.length;
  String[] typeSignatures = new String[length];
  for(int i = 0; i < length; i++) {
    char[][] compoundName = types[i].getParameterizedTypeName();
    char[] typeName = CharOperation.concatWith(compoundName, '.');
    typeSignatures[i] = Signature.createTypeSignature(typeName, false/*don't resolve*/);
  }
  return typeSignatures;
}
/**

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

/**
 * @see IMethod
 */
@Override
public String getReturnType() throws JavaModelException {
  SourceMethodElementInfo info = (SourceMethodElementInfo) getElementInfo();
  return Signature.createTypeSignature(info.getReturnTypeName(), false);
}
/**

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

/**
 * @see IMethod
 */
public String getReturnType() throws JavaModelException {
  SourceMethodElementInfo info = (SourceMethodElementInfo) getElementInfo();
  return Signature.createTypeSignature(info.getReturnTypeName(), false);
}
/**

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

private String getTypeParameterErasure(ITypeParameter typeParameter, IType context) throws JavaModelException {
  String[] bounds= typeParameter.getBounds();
  if (bounds.length > 0) {
    return getErasedTypeName(Signature.createTypeSignature(bounds[0], false), context);
  }
  return "Object"; //$NON-NLS-1$
}

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

private String getTypeParameterErasure(ITypeParameter typeParameter, IType context) throws JavaModelException {
  String[] bounds= typeParameter.getBounds();
  if (bounds.length > 0) {
    return getErasedTypeName(Signature.createTypeSignature(bounds[0], false), context);
  }
  return "Object"; //$NON-NLS-1$
}

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

/**
 * @see IMethod
 */
public String getReturnType() throws JavaModelException {
  SourceMethodElementInfo info = (SourceMethodElementInfo) getElementInfo();
  return Signature.createTypeSignature(info.getReturnTypeName(), false);
}
/**

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

/**
 * @see IMethod
 */
public String getSignature() throws JavaModelException {
  SourceMethodElementInfo info = (SourceMethodElementInfo) getElementInfo();
  return Signature.createMethodSignature(this.parameterTypes, Signature.createTypeSignature(info.getReturnTypeName(), false));
}
/**

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

/**
 * @see IMethod
 */
@Override
public String getSignature() throws JavaModelException {
  SourceMethodElementInfo info = (SourceMethodElementInfo) getElementInfo();
  return Signature.createMethodSignature(this.parameterTypes, Signature.createTypeSignature(info.getReturnTypeName(), false));
}
/**

相关文章