public class PojoDescriptorBuilderImpl extends AbstractPojoDescriptorBuilder
PojoDescriptorBuilder
interface.Modifier and Type | Field and Description |
---|---|
private ExtendedPojoDescriptorDependenciesImpl |
configuration |
private PojoFieldIntrospector |
fieldIntrospector |
private PojoMethodIntrospector |
methodIntrospector |
Constructor and Description |
---|
PojoDescriptorBuilderImpl()
The constructor.
|
PojoDescriptorBuilderImpl(MapFactory mapFactory)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected <P> PojoDescriptorImpl<P> |
createDescriptor(GenericType<P> pojoType)
This method creates the
pojo descriptor for
the given pojoType . |
protected void |
doInitialize()
This method performs the actual
initialization . |
protected Collection<PojoPropertyAccessorBuilder<?>> |
getAccessorBuilders()
|
protected ExtendedPojoDescriptorDependenciesImpl |
getDependencies()
This method gets the
ExtendedPojoDescriptorDependenciesImpl . |
protected PojoFieldIntrospector |
getFieldIntrospector()
|
protected PojoMethodIntrospector |
getMethodIntrospector()
This method gets the introspector used to find potential
methods for
accessing properties of a POJO . |
protected ReflectionUtilLimited |
getReflectionUtil()
This method gets the instance of
ReflectionUtilLimited . |
private <P> void |
introspectFields(Class<P> pojoClass,
PojoDescriptorImpl<P> descriptor,
List<AccessibleObject> nonPublicAccessibleObjects)
|
private <P> void |
introspectMethods(Class<P> pojoClass,
PojoDescriptorImpl<P> descriptor,
List<AccessibleObject> nonPublicAccessibleObjects)
|
private boolean |
isPublicAccessible(Member member)
This method determines if the given
Member is accessible
or public (declared as public in a public class). |
protected void |
logDuplicateAccessor(PojoPropertyAccessor accessor,
PojoPropertyAccessor duplicate)
|
private void |
makeAccessible(List<AccessibleObject> nonPublicAccessibleObjects)
|
private <P> void |
mergeDescriptorWithSuperClass(Class<P> pojoClass,
PojoDescriptorImpl<P> descriptor)
This method creates the
PojoDescriptorImpl for the superclass of
pojoClass and merges PojoPropertyDescriptorImpl from inherited properties. |
private void |
mergePropertyDescriptorWithSuperClass(PojoPropertyDescriptorImpl propertyDescriptor,
PojoPropertyDescriptorImpl superPropertyDescriptor)
This method merges the
superPropertyDescriptor into the propertyDescriptor . |
protected boolean |
registerAccessor(PojoDescriptorImpl<?> descriptor,
PojoPropertyAccessor accessor)
This method registers the given
accessor for the given descriptor . |
void |
setConfiguration(ExtendedPojoDescriptorDependenciesImpl configuration)
This method sets the
ExtendedPojoDescriptorDependenciesImpl . |
void |
setFieldIntrospector(PojoFieldIntrospector introspector)
This method sets the
field-introspector . |
void |
setMethodIntrospector(PojoMethodIntrospector introspector)
This method sets the
method-introspector . |
getDescriptor, getDescriptor, getDescriptor, pojo2Map
createLogger, getLogger
doInitialized, getInitializationState, initialize
private ExtendedPojoDescriptorDependenciesImpl configuration
getDependencies()
private PojoMethodIntrospector methodIntrospector
getMethodIntrospector()
private PojoFieldIntrospector fieldIntrospector
getFieldIntrospector()
public PojoDescriptorBuilderImpl()
methods
that are public and NOT static. AbstractComponent.initialize()
this component before it can be used.public PojoDescriptorBuilderImpl(MapFactory mapFactory)
methods
that are public and NOT static. AbstractComponent.initialize()
this component before it can be used.mapFactory
- is the factory used to create the descriptor cache.protected void doInitialize()
initialization
. It is called when
AbstractComponent.initialize()
is invoked for the first time. super.AbstractComponent.doInitialize()
.doInitialize
in class AbstractLoggableComponent
protected PojoMethodIntrospector getMethodIntrospector()
methods
for
accessing
properties
of a POJO
.@Inject public void setMethodIntrospector(PojoMethodIntrospector introspector)
method-introspector
.introspector
- the introspector to set.protected PojoFieldIntrospector getFieldIntrospector()
public void setFieldIntrospector(PojoFieldIntrospector introspector)
field-introspector
.introspector
- the introspector to set.protected Collection<PojoPropertyAccessorBuilder<?>> getAccessorBuilders()
protected ExtendedPojoDescriptorDependenciesImpl getDependencies()
ExtendedPojoDescriptorDependenciesImpl
.ExtendedPojoDescriptorDependenciesImpl
.protected ReflectionUtilLimited getReflectionUtil()
ReflectionUtilLimited
.getReflectionUtil
in class AbstractPojoDescriptorBuilder
ReflectionUtilLimited
.@Inject public void setConfiguration(ExtendedPojoDescriptorDependenciesImpl configuration)
ExtendedPojoDescriptorDependenciesImpl
.configuration
- is the ExtendedPojoDescriptorDependenciesImpl
.protected boolean registerAccessor(PojoDescriptorImpl<?> descriptor, PojoPropertyAccessor accessor)
accessor
for the given descriptor
.descriptor
- is the PojoDescriptor
.accessor
- is the PojoPropertyAccessor
to register.true
if the given accessor
has been registered or false
if
it has been ignored (it is a duplicate).protected <P> PojoDescriptorImpl<P> createDescriptor(GenericType<P> pojoType)
pojo descriptor
for
the given pojoType
.createDescriptor
in class AbstractPojoDescriptorBuilder
P
- is the templated type of the pojoType
.pojoType
- is the GenericType
reflecting the Pojo
.Pojo
.PojoDescriptorBuilder.getDescriptor(java.lang.Class)
private void makeAccessible(List<AccessibleObject> nonPublicAccessibleObjects)
nonPublicAccessibleObjects
- is the List
where the non-public AccessibleObject
s have
been collected.private <P> void introspectFields(Class<P> pojoClass, PojoDescriptorImpl<P> descriptor, List<AccessibleObject> nonPublicAccessibleObjects)
P
- is the generic type of pojoClass
.pojoClass
- is the Class
for the pojo type
.descriptor
- is the PojoDescriptorImpl
where to add PojoPropertyAccessor
s for
detected properties.nonPublicAccessibleObjects
- is the List
where to add non-public AccessibleObject
s.private <P> void introspectMethods(Class<P> pojoClass, PojoDescriptorImpl<P> descriptor, List<AccessibleObject> nonPublicAccessibleObjects)
P
- is the generic type of pojoClass
.pojoClass
- is the Class
for the pojo type
.descriptor
- is the PojoDescriptorImpl
where to add PojoPropertyAccessor
s for
detected properties.nonPublicAccessibleObjects
- is the List
where to add non-public AccessibleObject
s.private <P> void mergeDescriptorWithSuperClass(Class<P> pojoClass, PojoDescriptorImpl<P> descriptor)
PojoDescriptorImpl
for the superclass
of
pojoClass
and merges PojoPropertyDescriptorImpl
from inherited properties.P
- is the generic type of pojoClass
.pojoClass
- is the Class
for the pojo type
.descriptor
- is the PojoDescriptorImpl
to merge.private void mergePropertyDescriptorWithSuperClass(PojoPropertyDescriptorImpl propertyDescriptor, PojoPropertyDescriptorImpl superPropertyDescriptor)
superPropertyDescriptor
into the propertyDescriptor
.propertyDescriptor
- is the PojoPropertyDescriptorImpl
to build for the
Pojo
.superPropertyDescriptor
- is the super PojoPropertyDescriptorImpl
to "inherit" from.private boolean isPublicAccessible(Member member)
Member
is accessible
or public
(declared as public in a public class).member
- is the Member
to check.true
if it can be accessed, false
if it needs to be made accessible.protected void logDuplicateAccessor(PojoPropertyAccessor accessor, PojoPropertyAccessor duplicate)
accessor
given by duplicate
was
ignored because it has the same name
and
mode
as the given accessor
that is already
registered. This method does nothing. It may be overridden to do some debug logging.accessor
- is the accessor that is already registered.duplicate
- is the duplicate that has been ignored.Copyright © 2001–2014 mmm-Team. All rights reserved.