Package org.apache.cayenne.reflect

## Class ClassDescriptorMap

- java.lang.Object
- - org.apache.cayenne.reflect.ClassDescriptorMap

-     public class ClassDescriptorMap
      extends Object

  An object that holds class descriptors for mapped entities, compiling new descriptors on demand using an internal chain of descriptor factories. Note that the object is not synchronized internally, so it has to be prefilled with descriptors by the caller on initialization via calling 'getDescriptor' for all mapped entities.
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected Map<String,​ClassDescriptor>` | `descriptors` |
    `protected List<ClassDescriptorFactory>` | `factories` |
    `protected EntityResolver` | `resolver` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ClassDescriptorMap​(EntityResolver resolver)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addDescriptor​(String entityName, ClassDescriptor descriptor)` | Caches descriptor definition.
    `void` | `addFactory​(ClassDescriptorFactory factory)` | Adds a factory to the descriptor factory chain.
    `void` | `clearDescriptors()` |
    `void` | `clearFactories()` |
    `protected ClassDescriptor` | `createDescriptor​(String entityName)` | Creates a new descriptor.
    `protected ClassDescriptor` | `createProxyDescriptor​(String entityName)` | Creates a descriptor wrapper that will compile the underlying descriptor on demand.
    `ClassDescriptor` | `getDescriptor​(String entityName)` |
    `EntityResolver` | `getResolver()` |
    `void` | `removeDescriptor​(String entityName)` | Removes cached descriptor if any for the given entity.
    `void` | `removeFactory​(ClassDescriptorFactory factory)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### resolver

          protected EntityResolver resolver

    - #### descriptors

          protected Map<String,​ClassDescriptor> descriptors

    - #### factories

          protected List<ClassDescriptorFactory> factories

  - ### Constructor Detail

    - #### ClassDescriptorMap

          public ClassDescriptorMap​(EntityResolver resolver)

  - ### Method Detail

    - #### getResolver

          public EntityResolver getResolver()

    - #### addFactory

          public void addFactory​(ClassDescriptorFactory factory)

      Adds a factory to the descriptor factory chain.

    - #### removeFactory

          public void removeFactory​(ClassDescriptorFactory factory)

    - #### clearFactories

          public void clearFactories()

    - #### clearDescriptors

          public void clearDescriptors()

    - #### removeDescriptor

          public void removeDescriptor​(String entityName)

      Removes cached descriptor if any for the given entity.

    - #### addDescriptor

          public void addDescriptor​(String entityName,
                                    ClassDescriptor descriptor)

      Caches descriptor definition.

    - #### getDescriptor

          public ClassDescriptor getDescriptor​(String entityName)

    - #### createProxyDescriptor

          protected ClassDescriptor createProxyDescriptor​(String entityName)

      Creates a descriptor wrapper that will compile the underlying descriptor on demand. Using proxy indirection is needed to compile relationships of descriptors to other descriptors that are not compiled yet.

    - #### createDescriptor

          protected ClassDescriptor createDescriptor​(String entityName)

      Creates a new descriptor.