Classes

org.specs2.reflect.Classes$
See theClasses companion trait
object Classes extends Classes

This object provides simple functions to instantiate classes.

Attributes

Companion
trait
Graph
Supertypes
trait Classes
class Object
trait Matchable
class Any
Self type
Classes.type

Members list

Value members

Inherited methods

def createInstance[T <: AnyRef](className: String, loader: ClassLoader, defaultInstances: => List[AnyRef])(using m: ClassTag[T]): Operation[T]

Attributes

Inherited from:
Classes
def createInstanceEither[T <: AnyRef](className: String, loader: ClassLoader, defaultInstances: => List[AnyRef])(using m: ClassTag[T]): Operation[Either[Throwable, T]]

try to create an instance but return an exception if this is not possible

try to create an instance but return an exception if this is not possible

Attributes

Inherited from:
Classes
def createInstanceFromClass[T <: AnyRef](klass: Class[T], loader: ClassLoader, defaultInstances: => List[AnyRef])(using m: ClassTag[T]): Operation[T]

Attributes

Inherited from:
Classes
def createInstanceFromClass[T <: AnyRef](klass: Class[T], defaultInstances: => List[AnyRef])(using m: ClassTag[T]): Operation[T]

Attributes

Inherited from:
Classes
def createInstanceFromName[T <: AnyRef](className: String, defaultInstances: => List[AnyRef])(using m: ClassTag[T]): Operation[T]

Try to create an instance of a given class by using whatever constructor is available and trying to instantiate the first parameter recursively if there is a parameter for that constructor.

Try to create an instance of a given class by using whatever constructor is available and trying to instantiate the first parameter recursively if there is a parameter for that constructor.

This is useful to instantiate nested classes which are referencing their outer class in their constructor

Attributes

Inherited from:
Classes
def existsClass(className: String, loader: ClassLoader): Operation[Boolean]

Attributes

Returns

true if a class can be loaded

Inherited from:
Classes
def loadClass[T <: AnyRef](className: String, loader: ClassLoader): Operation[Class[T]]

Attributes

Inherited from:
Classes
def loadClassEither[T <: AnyRef](className: String, loader: ClassLoader): Operation[Either[Throwable, Class[T]]]

Load a class, given the class name

Load a class, given the class name

Attributes

Inherited from:
Classes