org.netbeans.modules.java.source 0.60.2 10

org.netbeans.api.java.source
Class TypeUtilities

java.lang.Object
  extended by org.netbeans.api.java.source.TypeUtilities

public final class TypeUtilities
extends Object

Various utilities related to the TypeMirrors.

Since:
0.6
See Also:
Types

Method Summary
 boolean isCastable(TypeMirror t1, TypeMirror t2)
          Check if type t1 can be cast to t2.
 TypeMirror substitute(TypeMirror type, List<? extends TypeMirror> from, List<? extends TypeMirror> to)
          Substitute all occurrences of a type in 'from' with the corresponding type in 'to' in 'type'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isCastable

public boolean isCastable(TypeMirror t1,
                          TypeMirror t2)
Check if type t1 can be cast to t2.

Parameters:
t1 - cast from type
t2 - cast to type
Returns:
true if and only if type t1 can be cast to t2 without a compile time error
Throws:
IllegalArgumentException - if the 't1' is of EXACUTABLE, PACKAGE, NONE, or OTHER kind
Since:
0.6

substitute

public TypeMirror substitute(TypeMirror type,
                             List<? extends TypeMirror> from,
                             List<? extends TypeMirror> to)
Substitute all occurrences of a type in 'from' with the corresponding type in 'to' in 'type'. 'from' and 'to' lists have to be of the same length.

Parameters:
type - in which the types should be substituted
from - types to substitute
to - substitute to types
Returns:
type corresponding to input 'type' with all references to any type from 'from' replaced with a corresponding type from 'to'
Throws:
IllegalArgumentException - if the 'from' and 'to' lists are not of the same length
Since:
0.36

org.netbeans.modules.java.source 0.60.2 10

Built on July 29 2010.  |  Portions Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.