View Javadoc
1   package net.florianschoppmann.java.type;
2   
3   import javax.lang.model.type.TypeMirror;
4   import java.util.List;
5   
6   /**
7    * Represents an intersection type, equivalent to {@code javax.lang.model.type.IntersectionType} in JDK 8.
8    *
9    * <p>Implementations may implement both {@code javax.lang.model.type.IntersectionType} and this interface. At some time
10   * in the future, when Java 7 compatibility is no longer required, this interface will be deprecated and eventually
11   * removed in favor of {@code javax.lang.model.type.IntersectionType}.
12   */
13  public interface IntersectionType extends TypeMirror, AnnotatedConstruct {
14      /**
15       * Return the bounds comprising this intersection type.
16       *
17       * @return the bounds of this intersection types.
18       */
19      List<? extends TypeMirror> getBounds();
20  
21      /**
22       * Returns whether this type mirror represents an intersection type.
23       *
24       * <p>Since implementations may choose to implement multiple {@link TypeMirror} sub-interfaces at the same time,
25       * this method exists so that an object can explicitly indicate whether it represents an intersection type.
26       *
27       * @return whether this type mirror represents an intersection type
28       */
29      boolean isIntersectionType();
30  }