Search in sources :

Example 1 with ClassDescriptorMap

use of org.apache.cayenne.reflect.ClassDescriptorMap in project cayenne by apache.

the class ClientEntityResolver method getClassDescriptorMap.

@Override
public ClassDescriptorMap getClassDescriptorMap() {
    if (classDescriptorMap == null) {
        ClassDescriptorMap classDescriptorMap = new ClassDescriptorMap(this);
        classDescriptorMap.addFactory(new ValueHolderDescriptorFactory(classDescriptorMap));
        // entity proxies here.
        for (DataMap map : maps) {
            for (String entityName : map.getObjEntityMap().keySet()) {
                classDescriptorMap.getDescriptor(entityName);
            }
        }
        this.classDescriptorMap = classDescriptorMap;
    }
    return classDescriptorMap;
}
Also used : ValueHolderDescriptorFactory(org.apache.cayenne.reflect.valueholder.ValueHolderDescriptorFactory) ClassDescriptorMap(org.apache.cayenne.reflect.ClassDescriptorMap)

Example 2 with ClassDescriptorMap

use of org.apache.cayenne.reflect.ClassDescriptorMap in project cayenne by apache.

the class EntityResolver method getClassDescriptorMap.

/**
 * Returns an object that compiles and stores {@link ClassDescriptor}
 * instances for all entities.
 *
 * @since 3.0
 */
public ClassDescriptorMap getClassDescriptorMap() {
    if (classDescriptorMap == null) {
        synchronized (this) {
            if (classDescriptorMap == null) {
                ClassDescriptorMap classDescriptorMap = new ClassDescriptorMap(this);
                FaultFactory faultFactory = new SingletonFaultFactory();
                // add factories in reverse of the desired chain order
                classDescriptorMap.addFactory(new ValueHolderDescriptorFactory(classDescriptorMap));
                classDescriptorMap.addFactory(new DataObjectDescriptorFactory(classDescriptorMap, faultFactory));
                // it with entity proxies here.
                for (DataMap map : maps) {
                    for (String entityName : map.getObjEntityMap().keySet()) {
                        classDescriptorMap.getDescriptor(entityName);
                    }
                }
                this.classDescriptorMap = classDescriptorMap;
            }
        }
    }
    return classDescriptorMap;
}
Also used : ValueHolderDescriptorFactory(org.apache.cayenne.reflect.valueholder.ValueHolderDescriptorFactory) SingletonFaultFactory(org.apache.cayenne.reflect.SingletonFaultFactory) DataObjectDescriptorFactory(org.apache.cayenne.reflect.generic.DataObjectDescriptorFactory) ClassDescriptorMap(org.apache.cayenne.reflect.ClassDescriptorMap) FaultFactory(org.apache.cayenne.reflect.FaultFactory) SingletonFaultFactory(org.apache.cayenne.reflect.SingletonFaultFactory)

Aggregations

ClassDescriptorMap (org.apache.cayenne.reflect.ClassDescriptorMap)2 ValueHolderDescriptorFactory (org.apache.cayenne.reflect.valueholder.ValueHolderDescriptorFactory)2 FaultFactory (org.apache.cayenne.reflect.FaultFactory)1 SingletonFaultFactory (org.apache.cayenne.reflect.SingletonFaultFactory)1 DataObjectDescriptorFactory (org.apache.cayenne.reflect.generic.DataObjectDescriptorFactory)1