GenericReflector Class

Summary

db4o provides GenericReflector as a wrapper around specific reflector (delegate).
Assembly
Db4objects.Db4o-2010.dll
Namespace
Db4objects.Db4o.Reflect.Generic
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IReflector"] click Interface0 "/db4o-gpl-doc/output/api/Db4objects.Db4o.Reflect/IReflector" Type-.->Interface1["IDeepClone"] click Interface1 "/db4o-gpl-doc/output/api/Db4objects.Db4o.Foundation/IDeepClone" Type["GenericReflector"] class Type type-node

Syntax

public class GenericReflector : IReflector, IDeepClone

Remarks

db4o provides GenericReflector as a wrapper around specific reflector (delegate). GenericReflector is set when an ObjectContainer is opened. All subsequent reflector calls are routed through this interface.

An instance of GenericReflector can be obtained through Db4objects.Db4o.Ext.IExtObjectContainer.Reflector .

GenericReflector keeps list of known classes in memory. When the GenericReflector is called, it first checks its list of known classes. If the class cannot be found, the task is transferred to the delegate reflector. If the delegate fails as well, generic objects are created, which hold simulated "field values" in an array of objects.

Generic reflector makes possible the following usecases:
  • running a db4o server without deploying application classes;
  • running db4o on Java dialects without reflection (J2ME CLDC, MIDP);
  • easier access to stored objects where classes or fields are not available;
  • running refactorings in the reflector;
  • building interfaces to db4o from any programming language.


One of the live usecases is ObjectManager, which uses GenericReflector to read C# objects from Java.

Constructors

Name Summary
GenericReflector(IReflector)
GenericReflector(Transaction, IReflector) Creates an instance of GenericReflector

Methods

Name Value Summary
Array() IReflectArray
Configuration(IReflectorConfiguration) void
DeepClone(Object) Object
Creates a clone of provided object
ForClass(Type) IReflectClass
Returns a ReflectClass instance for the specified class
ForName(string) IReflectClass
Returns a ReflectClass instance for the specified class name
ForObject(Object) IReflectClass
Returns a ReflectClass instance for the specified class object
GetDelegate() IReflector
Returns delegate reflector
HasTransaction() bool
If there is a transaction assosiated with the current refector.
IsCollection(IReflectClass) bool
Determines if a candidate ReflectClass is a collection
KnownClasses() IReflectClass[]
Returns an array of classes known to the reflector
Register(GenericClass) void
Register a class
RegisterCollection(IReflectClassPredicate) void
Register a predicate as a collection
RegisterCollection(Type) void
Register a class as a collection
RegisterPrimitiveClass(int, string, IGenericConverter) void
Registers primitive class
SetParent(IReflector) void
method stub: generic reflector does not have a parent
SetTransaction(Transaction) void
Associated a transaction with the current reflector.