org.mule.devkit.model.code
Class TypeVariable

java.lang.Object
  extended by org.mule.devkit.model.code.Type
      extended by org.mule.devkit.model.code.TypeReference
          extended by org.mule.devkit.model.code.TypeVariable
All Implemented Interfaces:
Comparable<Type>, Declaration, Generable

public final class TypeVariable
extends TypeReference
implements Declaration

Type variable used to declare generics.

Author:
Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
See Also:
Generifiable

Field Summary
 
Fields inherited from class org.mule.devkit.model.code.TypeReference
EMPTY_ARRAY
 
Method Summary
 TypeReference _extends()
          Returns the class bound of this variable.
 Iterator<TypeReference> _implements()
          Returns the interface bounds of this variable.
 GeneratedPackage _package()
          Gets the package to which this class belongs.
 TypeVariable bound(TypeReference c)
          Adds a bound to this variable.
 void declare(Formatter f)
          Prints out the declaration of the variable.
 String fullName()
          Gets the full name of the type.
 void generate(Formatter f)
           
 boolean isAbstract()
          Checks if this class is an abstract class.
 boolean isInterface()
          Checks if this object represents an interface.
 String name()
          Gets the name of this class.
protected  TypeReference substituteParams(TypeVariable[] variables, List<TypeReference> bindings)
          Substitutes the type variables with their actual arguments.
 
Methods inherited from class org.mule.devkit.model.code.TypeReference
array, array, boxify, erasure, getBaseClass, getBaseClass, getPrimitiveType, getTypeParameters, isAssignableFrom, isParameterized, narrow, narrow, narrow, narrow, narrow, narrow, narrow, outer, owner, staticInvoke, staticInvoke, staticRef, staticRef, toString, typeParams, unboxify, wildcard
 
Methods inherited from class org.mule.devkit.model.code.Type
binaryName, compareTo, dotclass, elementType, equals, hashCode, isArray, isPrimitive, isReference, parse
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

name

public String name()
Description copied from class: TypeReference
Gets the name of this class.

Specified by:
name in class TypeReference
Returns:
name of this class, without any qualification. For example, this method returns "String" for java.lang.String.

fullName

public String fullName()
Description copied from class: Type
Gets the full name of the type.

See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details.

Specified by:
fullName in class Type
Returns:
Strings like "int", "java.lang.String", "java.io.File[]". Never null.

_package

public GeneratedPackage _package()
Description copied from class: TypeReference
Gets the package to which this class belongs. TODO: shall we move move this down?

Specified by:
_package in class TypeReference

bound

public TypeVariable bound(TypeReference c)
Adds a bound to this variable.

Returns:
this

_extends

public TypeReference _extends()
Returns the class bound of this variable.

If no bound is given, this method returns Object.

Specified by:
_extends in class TypeReference
Returns:
Returns the TypeReference representing the superclass of the entity (class or interface) represented by this TypeReference. Even if no super class is given explicitly or this TypeReference is not a class, this method still returns TypeReference for Object. If this TypeReference represents Object, return null.

_implements

public Iterator<TypeReference> _implements()
Returns the interface bounds of this variable.

Specified by:
_implements in class TypeReference
Returns:
A non-null valid iterator that iterates all TypeReference objects that represents those interfaces implemented by this object.

isInterface

public boolean isInterface()
Description copied from class: TypeReference
Checks if this object represents an interface.

Specified by:
isInterface in class TypeReference

isAbstract

public boolean isAbstract()
Description copied from class: TypeReference
Checks if this class is an abstract class.

Specified by:
isAbstract in class TypeReference

declare

public void declare(Formatter f)
Prints out the declaration of the variable.

Specified by:
declare in interface Declaration

substituteParams

protected TypeReference substituteParams(TypeVariable[] variables,
                                         List<TypeReference> bindings)
Description copied from class: TypeReference
Substitutes the type variables with their actual arguments.

For example, when this class is Map<String,Map<V>>, (where V then doing substituteParams( V, Integer ) returns a TypeReference for Map<String,Map<Integer>>.

This method needs to work recursively.

Specified by:
substituteParams in class TypeReference

generate

public void generate(Formatter f)
Specified by:
generate in interface Generable
Overrides:
generate in class TypeReference


Copyright © 2010–2014 MuleSoft, Inc.. All rights reserved.