Codota Logo
IType.getTypeParameters
Code IndexAdd Codota to your IDE (free)

How to use
getTypeParameters
method
in
org.eclipse.jdt.core.IType

Best Java code snippets using org.eclipse.jdt.core.IType.getTypeParameters (Showing top 20 results out of 315)

  • Common ways to obtain IType
private void myMethod () {
IType i =
  • Codota IconIMethod method;method.getDeclaringType()
  • Codota IconIJavaProject javaProject;String fullyQualifiedName;javaProject.findType(fullyQualifiedName)
  • Codota IconIMember member;member.getDeclaringType()
  • Smart code suggestions by Codota
}
origin: org.eclipse/org.eclipse.jdt.ui

  private boolean hasParameters() {
    try {
      IType type= (IType) getJavaElement();
      if (type == null)
        return false;

      return type.getTypeParameters().length > 0;
    } catch (JavaModelException e) {
      return false;
    }
  }
}
origin: org.eclipse.recommenders.completion.rcp/subwords

private boolean hasParameters() {
  try {
    final IType type = (IType) getJavaElement();
    if (type == null) {
      return false;
    }
    return type.getTypeParameters().length > 0;
  } catch (final JavaModelException e) {
    return false;
  }
}
origin: org.eclipse.recommenders.completion/rcp

private boolean hasParameters() {
  try {
    final IType type = (IType) getJavaElement();
    if (type == null) {
      return false;
    }
    return type.getTypeParameters().length > 0;
  } catch (final JavaModelException e) {
    return false;
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private boolean hasParameters() {
  try {
    IType type= (IType) getJavaElement();
    if (type == null)
      return false;
    return type.getTypeParameters().length > 0;
  } catch (JavaModelException e) {
    return false;
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private boolean hasParameters() {
  try {
    IType type= (IType) getJavaElement();
    if (type == null)
      return false;
    return type.getTypeParameters().length > 0;
  } catch (JavaModelException e) {
    return false;
  }
}
origin: wala/WALA

public static Collection<String> getTypeParameterNames(IType type) throws IllegalArgumentException, JavaModelException {
 if (type == null) {
  throw new IllegalArgumentException("type == null");
 }
 ITypeParameter[] tp = type.getTypeParameters();
 Collection<String> typeParameterNames = HashSetFactory.make(tp.length);
 for (ITypeParameter p : tp) {
  typeParameterNames.add(p.getElementName());
 }
 return typeParameterNames;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  private static boolean isParameterizedElement(IJavaElement element) {
    while (element != null) {
      ITypeParameter[] typeParameters= null;
      try {
        if (element instanceof IType) {
          typeParameters= ((IType)element).getTypeParameters();
        } else if (element instanceof IMethod) {
          typeParameters= ((IMethod)element).getTypeParameters();
        }
      } catch (JavaModelException e) {
        return false;
      }
      if (typeParameters == null)
        return false;
      
      if (typeParameters.length > 0)
        return true;
      
      element= element.getParent();
    }
    return false;
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

  public boolean isApplicable(JavaSearchQuery query) {
    QuerySpecification spec= query.getSpecification();
    if (spec instanceof ElementQuerySpecification) {
      ElementQuerySpecification elementSpec= (ElementQuerySpecification) spec;
      Object element= elementSpec.getElement();
      ITypeParameter[] typeParameters= null;
      try {
        if (element instanceof IType) {
          typeParameters= ((IType)element).getTypeParameters();
        } else if (element instanceof IMethod) {
          typeParameters= ((IMethod)element).getTypeParameters();
        }
      } catch (JavaModelException e) {
        return false;
      }
      return typeParameters != null && typeParameters.length > 0;
    }
    return false;
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private String createTypeComment(IType type, String lineDelimiter) throws CoreException {
  String[] typeParameterNames= StubUtility.getTypeParameterNames(type.getTypeParameters());
  return CodeGeneration.getTypeComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), typeParameterNames, lineDelimiter);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private String createTypeTags(IDocument document, DocumentCommand command, String indentation, String lineDelimiter, IType type)
  throws CoreException, BadLocationException
{
  String[] typeParamNames= StubUtility.getTypeParameterNames(type.getTypeParameters());
  String comment= CodeGeneration.getTypeComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), typeParamNames, lineDelimiter);
  if (comment != null) {
    boolean javadocComment= comment.startsWith("/**"); //$NON-NLS-1$
    if (!isFirstComment(document, command, type, javadocComment))
      return null;
    return prepareTemplateComment(comment.trim(), indentation, type.getJavaProject(), lineDelimiter);
  }
  return null;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private String createTypeComment(IType type, String lineDelimiter) throws CoreException {
  String[] typeParameterNames= StubUtility.getTypeParameterNames(type.getTypeParameters());
  return CodeGeneration.getTypeComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), typeParameterNames, lineDelimiter);
}
origin: org.eclipse/org.eclipse.jdt.ui

private String createTypeComment(IType type, String lineDelimiter) throws CoreException {
  String[] typeParameterNames= StubUtility.getTypeParameterNames(type.getTypeParameters());
  return CodeGeneration.getTypeComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), typeParameterNames, lineDelimiter);
}        

origin: org.eclipse/org.eclipse.jdt.ui

private String createTypeTags(IDocument document, DocumentCommand command, String indentation, String lineDelimiter, IType type)
  throws CoreException, BadLocationException
{
  String[] typeParamNames= StubUtility.getTypeParameterNames(type.getTypeParameters());
  String comment= CodeGeneration.getTypeComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), typeParamNames, lineDelimiter);
  if (comment != null) {
    boolean javadocComment= comment.startsWith("/**"); //$NON-NLS-1$
    if (!isFirstComment(document, command, type, javadocComment)) 
      return null;
    return prepareTemplateComment(comment.trim(), indentation, type.getJavaProject(), lineDelimiter);
  }
  return null;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private String createTypeTags(IDocument document, DocumentCommand command, String indentation, String lineDelimiter, IType type)
  throws CoreException, BadLocationException
{
  String[] typeParamNames= StubUtility.getTypeParameterNames(type.getTypeParameters());
  String comment= CodeGeneration.getTypeComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), typeParamNames, lineDelimiter);
  if (comment != null) {
    boolean javadocComment= comment.startsWith("/**"); //$NON-NLS-1$
    if (!isFirstComment(document, command, type, javadocComment))
      return null;
    return prepareTemplateComment(comment.trim(), indentation, type.getJavaProject(), lineDelimiter);
  }
  return null;
}
origin: eclipse/eclipse.jdt.ls

static int mapTypeParameterIndex(IType[] path, int pathIndex, int paramIndex) throws JavaModelException, ArrayIndexOutOfBoundsException {
  if (pathIndex == 0) {
    // break condition: we've reached the top of the hierarchy
    return paramIndex;
  }
  IType subType= path[pathIndex];
  IType superType= path[pathIndex - 1];
  String superSignature= findMatchingSuperTypeSignature(subType, superType);
  ITypeParameter param= subType.getTypeParameters()[paramIndex];
  int index= findMatchingTypeArgumentIndex(superSignature, param.getElementName());
  if (index == -1) {
    // not mapped through
    return -1;
  }
  return mapTypeParameterIndex(path, pathIndex - 1, index);
}
origin: eclipse/eclipse.jdt.ls

private String createTypeTags(IDocument document, int offset, String indentation, String lineDelimiter, IType type) throws CoreException, BadLocationException {
  if (!accept(offset, type)) {
    return null;
  }
  String[] typeParamNames = StubUtility.getTypeParameterNames(type.getTypeParameters());
  String comment = CodeGeneration.getTypeComment(type.getCompilationUnit(), type.getTypeQualifiedName('.'), typeParamNames, lineDelimiter);
  if (comment != null) {
    return prepareTemplateComment(comment.trim(), indentation, type.getJavaProject(), lineDelimiter);
  }
  return null;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private Type createEnclosingType(final AST ast) throws JavaModelException {
  Assert.isNotNull(ast);
  final ITypeParameter[] parameters= fType.getDeclaringType().getTypeParameters();
  final Type type= ASTNodeFactory.newType(ast, fType.getDeclaringType().getTypeQualifiedName('.'));
  if (parameters.length > 0) {
    final ParameterizedType parameterized= ast.newParameterizedType(type);
    for (int index= 0; index < parameters.length; index++)
      parameterized.typeArguments().add(ast.newSimpleType(ast.newSimpleName(parameters[index].getElementName())));
    return parameterized;
  }
  return type;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private Type createEnclosingType(final AST ast) throws JavaModelException {
  Assert.isNotNull(ast);
  final ITypeParameter[] parameters= fType.getDeclaringType().getTypeParameters();
  final Type type= ASTNodeFactory.newType(ast, fType.getDeclaringType().getTypeQualifiedName('.'));
  if (parameters.length > 0) {
    final ParameterizedType parameterized= ast.newParameterizedType(type);
    for (int index= 0; index < parameters.length; index++)
      parameterized.typeArguments().add(ast.newSimpleType(ast.newSimpleName(parameters[index].getElementName())));
    return parameterized;
  }
  return type;
}
origin: org.eclipse/org.eclipse.jdt.ui

private Type createEnclosingType(final AST ast) throws JavaModelException {
  Assert.isNotNull(ast);
  final ITypeParameter[] parameters= fType.getDeclaringType().getTypeParameters();
  final Type type= ASTNodeFactory.newType(ast, JavaModelUtil.getTypeQualifiedName(fType.getDeclaringType()));
  if (parameters.length > 0) {
    final ParameterizedType parameterized= ast.newParameterizedType(type);
    for (int index= 0; index < parameters.length; index++)
      parameterized.typeArguments().add(ast.newSimpleType(ast.newSimpleName(parameters[index].getElementName())));
    return parameterized;
  }
  return type;
}
origin: eclipse/eclemma

private static final boolean resolveTypeParameter(final IMethod method,
  final String identifier, final StringBuilder result)
  throws JavaModelException {
 IType type = method.getDeclaringType();
 if (resolveTypeParameter(type, method.getTypeParameters(), identifier,
   result)) {
  return true;
 }
 while (type != null) {
  if (resolveTypeParameter(type, type.getTypeParameters(), identifier,
    result)) {
   return true;
  }
  type = type.getDeclaringType();
 }
 return false;
}
org.eclipse.jdt.coreITypegetTypeParameters

Javadoc

Returns the formal type parameters for this type. Returns an empty array if this type has no formal type parameters.

Popular methods of IType

  • getFullyQualifiedName
    Returns the fully qualified name of this type, including qualification for any containing types and
  • getElementName
    Returns the simple name of this type, unqualified by package or enclosing type. This is a handle-onl
  • getMethods
    Returns the methods and constructors declared by this type. For binary types, this may include the s
  • getFlags
  • getPackageFragment
    Returns the package fragment in which this element is defined. This is a handle-only method.
  • getCompilationUnit
  • newSupertypeHierarchy
    Creates and returns a type hierarchy for this type containing this type and all of its supertypes, c
  • exists
  • getJavaProject
  • isInterface
    Returns whether this type represents an interface. Note that an interface can also be an annotation
  • getDeclaringType
  • getMethod
    Returns the method with the specified name and parameter types in this type (for example, "foo", {"I
  • getDeclaringType,
  • getMethod,
  • getParent,
  • isClass,
  • getSourceRange,
  • newTypeHierarchy,
  • isAnonymous,
  • isBinary,
  • getResource

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • JButton (javax.swing)
  • JComboBox (javax.swing)
  • JOptionPane (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now