public class DefaultEntityProxyFactory extends java.lang.Object implements EntityProxyFactory
EntityProxyFactory
implementation for JALSE. This proxy factory will
use EntityFunctionResolver
to resolve an EntityFunction
to translate the proxy
Method
calls to EntityMethod
s. Override addResolverFunctions()
to change
what EntityMethodFunction
s are added to the resolver. Entity
using DefaultEntityProxyFactory.EntityProxyCache
.Modifier and Type | Class and Description |
---|---|
protected class |
DefaultEntityProxyFactory.EntityProxyCache
A
WeakHashMap cache for Entity proxies. |
protected class |
DefaultEntityProxyFactory.EntityProxyHandler
The
InvocationHandler for the entity proxies. |
Modifier and Type | Field and Description |
---|---|
protected DefaultEntityProxyFactory.EntityProxyCache |
cache
Proxy cache for entities.
|
protected EntityFunctionResolver |
resolver
Resolver for entity types.
|
Constructor and Description |
---|
DefaultEntityProxyFactory()
Creates a new DefaultEntityProxyFactory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addResolverFunctions()
Adds the
EntityMethodFunction s to the resolver. |
boolean |
isProxyEntity(Entity e)
Checks whether the supplied entity is a proxy.
|
<T extends Entity> |
proxyOfEntity(Entity e,
java.lang.Class<T> type)
Creates a proxy of the entity subclass.
|
void |
uncacheAllProxies()
Uncaches all proxies.
|
void |
uncacheProxiesOfEntity(Entity e)
Uncaches all proxies for an entity.
|
void |
uncacheProxyOfEntity(Entity e,
java.lang.Class<? extends Entity> type)
Uncaches the specific type proxy for an entity.
|
void |
validateType(java.lang.Class<? extends Entity> type)
Validates the type can be proxied.
|
protected final EntityFunctionResolver resolver
protected final DefaultEntityProxyFactory.EntityProxyCache cache
public DefaultEntityProxyFactory()
addResolverFunctions()
protected void addResolverFunctions()
EntityMethodFunction
s to the resolver.public boolean isProxyEntity(Entity e)
EntityProxyFactory
isProxyEntity
in interface EntityProxyFactory
e
- Entity to check.public <T extends Entity> T proxyOfEntity(Entity e, java.lang.Class<T> type)
EntityProxyFactory
proxyOfEntity
in interface EntityProxyFactory
e
- Entity to proxy for.type
- Type to proxy as.public void uncacheAllProxies()
public void uncacheProxiesOfEntity(Entity e)
e
- Entity to uncache for.public void uncacheProxyOfEntity(Entity e, java.lang.Class<? extends Entity> type)
e
- Entity to uncache for.type
- Proxy type.public void validateType(java.lang.Class<? extends Entity> type)
EntityProxyFactory
validateType
in interface EntityProxyFactory
type
- Type to validate.