public interface ClassNameMapper
Interface for a simple component capable of
This interface is designed for frameworks that need to do heavy generic stuff. It should not be used by end-users and the
getting the name
for a Class
and
vice-versa
. The implementation is designed in a secure way as described in
getClass(String)
.This interface is designed for frameworks that need to do heavy generic stuff. It should not be used by end-users and the
lazy initialization
may consume some time.- Since:
- 1.0.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Type ofClass
es managed by thisClassNameMapper
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
static ClassNameMapper
get()
When you need to use this method, you need to have the following "requires [transitive]" statement in your module.Class<?>
getClasses
(ClassNameMapper.ClassType classType)
-
Method Details
-
getName
- Parameters:
javaClass
- theClass
reflecting the type (class, interface, etc.) to map.- Returns:
- the name of the given
Class
. By default this is thequalified name
but it may also be thesimple name
or something else as long as it is unique. - Throws:
io.github.mmm.base.exception.ObjectNotFoundException
- if the givenClass
is not mapped.
-
getClass
- Parameters:
name
- thename
of theClass
.- Returns:
- the
Class
reflecting the type with the givenname
. Will benull
if the type is not mapped. For security reasons by design no reflective lookup (class-loading) is triggered. This allows to deserialize or unmarshall polymorphic or generic data without allowing external users (or attackers) to trigger class-loading and potential code execution. - Throws:
io.github.mmm.base.exception.ObjectNotFoundException
- if the givenname
is not mapped.
-
contains
- Parameters:
javaClass
- theclass
to check.- Returns:
true
if the givenclass
is mapped by thisClassNameMapper
,false
otherwise.
-
contains
- Parameters:
name
- thename
to check.- Returns:
true
if the givenname
is mapped by thisClassNameMapper
,false
otherwise.
-
getClasses
- Parameters:
classType
- theClassNameMapper.ClassType
for which theClass
es are requested.- Returns:
- an
Iterator
of allClass
es registered for the givenClassNameMapper.ClassType
.
-
get
When you need to use this method, you need to have the following "requires [transitive]" statement in your module.requires io.github.mmm.bean.factory;
- Returns:
- the singleton instance of
ClassNameMapper
.
-