public class ClassHierarchyImpl extends Object implements JavaClassHierarchy
Constructor and Description |
---|
ClassHierarchyImpl() |
ClassHierarchyImpl(URL... jars) |
ClassHierarchyImpl(URL[] jars,
Class<? extends ExternalConstructor<?>>[] parameterParsers) |
Modifier and Type | Method and Description |
---|---|
Class<?> |
classForName(String name)
Helper method that converts a String to a Class using this
ClassHierarchy's classloader.
|
PackageNode |
getNamespace()
Return a reference to the root of the ClassHierarchy.
|
Node |
getNode(Class<?> clazz)
Look up a class object in this ClassHierarchy.
|
Node |
getNode(String name)
Lookup a node in this class hierarchy.
|
ParameterParser |
getParameterParser() |
boolean |
isImplementation(ClassNode<?> inter,
ClassNode<?> impl) |
ClassHierarchy |
merge(ClassHierarchy ch)
Merge the contents of this ClassHierarchy and the provided one into a new
class hierarchy.
|
<T> T |
parse(NamedParameterNode<T> np,
String value)
Parse a string, assuming that it is of the type expected by a given NamedParameter.
|
<T> T |
parseDefaultValue(NamedParameterNode<T> name)
A helper method that returns the parsed default value of a given
NamedParameter.
|
public ClassHierarchyImpl()
public ClassHierarchyImpl(URL... jars)
public ClassHierarchyImpl(URL[] jars, Class<? extends ExternalConstructor<?>>[] parameterParsers)
public <T> T parseDefaultValue(NamedParameterNode<T> name)
parseDefaultValue
in interface JavaClassHierarchy
name
- The named parameter that should be checked for a default instance.ClassHierarchyException
- if a default value was specified, but could not be parsed, or if a set of
values were specified for a non-set parameter.public <T> T parse(NamedParameterNode<T> np, String value) throws ParseException
parse
in interface JavaClassHierarchy
np
- The named parameter that will receive the value.value
- A string value to be validated and parsed.ParseException
- if the value failed to parse, or parsed to the
wrong type (such as when it specifies a class that does not implement
or extend T).public Class<?> classForName(String name) throws ClassNotFoundException
classForName
in interface JavaClassHierarchy
ClassNotFoundException
public Node getNode(Class<?> clazz)
JavaClassHierarchy
getNode
in interface JavaClassHierarchy
clazz
- The class to be looked up in the class hierarchy.public Node getNode(String name) throws NameResolutionException
ClassHierarchy
getNode
in interface ClassHierarchy
name
- The full name of the class that will be looked up.NameResolutionException
- If the class is not found.public PackageNode getNamespace()
ClassHierarchy
getNamespace
in interface ClassHierarchy
public ParameterParser getParameterParser()
public boolean isImplementation(ClassNode<?> inter, ClassNode<?> impl)
isImplementation
in interface ClassHierarchy
public ClassHierarchy merge(ClassHierarchy ch)
ClassHierarchy
merge
in interface ClassHierarchy
Copyright © 2015 The Apache Software Foundation. All rights reserved.