EntityScan
class
class EntityScan {
//---------------------------------
//
// Private properties
//
//---------------------------------
EntityScan _original;
List<_ProxyEntry> _proxies = new List<_ProxyEntry>();
List<_ProxyEntry> _identityProxies = new List<_ProxyEntry>();
List<EntityScan> _keyCollection;
//---------------------------------
//
// Public properties
//
//---------------------------------
Entity entity;
Function contructorMethod;
MetadataCache metadataCache;
String refClassName;
bool isMutableEntity = true;
//---------------------------------
// key
//---------------------------------
void buildKey() {
EntityKey nextKey = EntityAssembler._instance._keyChain;
_ProxyEntry entry;
int code;
int i = _identityProxies.length;
dynamic value;
while (i > 0) {
entry = _identityProxies[--i];
code = entry.proxy.propertySymbol.hashCode;
value = entry.proxy._value;
nextKey[code] = value;
nextKey = nextKey[[code, value]];
}
if (_keyCollection != nextKey.entityScans) {
if (_keyCollection != null) _keyCollection.remove(this);
_keyCollection = nextKey.entityScans..add(this);
}
}
//---------------------------------
//
// Constructor
//
//---------------------------------
EntityScan() {
metadataCache = new MetadataCache();
}
EntityScan.fromScan(EntityScan original, Entity entity) {
List<_ProxyEntry> originalProxies = original._proxies;
List<_ProxyEntry> originalIdentityProxies = original._identityProxies;
_ProxyEntry clonedEntry;
int i = originalProxies.length;
this._original = original;
this.entity = entity;
this.contructorMethod = original.contructorMethod;
this.metadataCache = original.metadataCache;
this.refClassName = original.refClassName;
this.isMutableEntity = original.isMutableEntity;
while (i > 0) {
clonedEntry = originalProxies[--i].clone();
this._proxies.add(clonedEntry);
if (clonedEntry.isIdentity) this._identityProxies.add(clonedEntry);
}
}
//---------------------------------
//
// Public methods
//
//---------------------------------
void addProxy(Property property, bool isIdentity) {
_ProxyEntry entry = new _ProxyEntry(property.property, isIdentity);
_proxies.add(entry);
if (isIdentity) {
_identityProxies.add(entry);
}
}
}
Constructors
new EntityScan() #
EntityScan() {
metadataCache = new MetadataCache();
}
new EntityScan.fromScan(EntityScan original, Entity entity) #
EntityScan.fromScan(EntityScan original, Entity entity) {
List<_ProxyEntry> originalProxies = original._proxies;
List<_ProxyEntry> originalIdentityProxies = original._identityProxies;
_ProxyEntry clonedEntry;
int i = originalProxies.length;
this._original = original;
this.entity = entity;
this.contructorMethod = original.contructorMethod;
this.metadataCache = original.metadataCache;
this.refClassName = original.refClassName;
this.isMutableEntity = original.isMutableEntity;
while (i > 0) {
clonedEntry = originalProxies[--i].clone();
this._proxies.add(clonedEntry);
if (clonedEntry.isIdentity) this._identityProxies.add(clonedEntry);
}
}
Properties
Function contructorMethod #
Function contructorMethod
bool isMutableEntity #
bool isMutableEntity = true
MetadataCache metadataCache
String refClassName #
Methods
void addProxy(Property property, bool isIdentity) #
void addProxy(Property property, bool isIdentity) {
_ProxyEntry entry = new _ProxyEntry(property.property, isIdentity);
_proxies.add(entry);
if (isIdentity) {
_identityProxies.add(entry);
}
}
void buildKey() #
void buildKey() {
EntityKey nextKey = EntityAssembler._instance._keyChain;
_ProxyEntry entry;
int code;
int i = _identityProxies.length;
dynamic value;
while (i > 0) {
entry = _identityProxies[--i];
code = entry.proxy.propertySymbol.hashCode;
value = entry.proxy._value;
nextKey[code] = value;
nextKey = nextKey[[code, value]];
}
if (_keyCollection != nextKey.entityScans) {
if (_keyCollection != null) _keyCollection.remove(this);
_keyCollection = nextKey.entityScans..add(this);
}
}