public final class Classes extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Classes.End |
static class |
Classes.FromClass |
Modifier and Type | Method and Description |
---|---|
static <T extends Class<?>> |
cast(Class<?> someClass)
Cast the specified class to a class parameterized with any generic type.
|
static <T> T |
cast(Object object)
Cast the specified object to an object of the specified type.
|
static Classes.FromClass |
from(Class<?> someClass)
Define the starting point of class reflection.
|
static <T> T |
instantiateDefault(Class<T> someClass)
Instantiate a class by invoking its default constructor.
|
static <T> Optional<Class<T>> |
optional(String dependency)
Checks if a class exists in the classpath.
|
public static <T> T instantiateDefault(Class<T> someClass)
T
- the type of the object to instantiate.someClass
- the class to instantiate.public static <T> Optional<Class<T>> optional(String dependency)
dependency
- class to look for.Optional
of the class (empty if class is not present).public static <T extends Class<?>> T cast(Class<?> someClass)
T
- the type to cast to.someClass
- the class to cast.public static <T> T cast(Object object)
T
- the type to cast to.object
- the object to cast.public static Classes.FromClass from(Class<?> someClass)
someClass
- the starting class for reflection operations.Copyright © 2013-2018–2019 SeedStack. All rights reserved.