All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jalse.entities.EntityProxyFactory Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package jalse.entities;

import jalse.entities.functions.EntityFunctionResolver;

import java.lang.reflect.InvocationHandler;

/**
 * This defines a factory for creating {@link Entity} proxies. Making a proxy of an {@link Entity}
 * subclass allows the {@link InvocationHandler} to translate the method calls into {@link Entity}
 * methods. This makes the subclasses more customisable for specific problems.
 *
 * @author Elliot Ford
 *
 * @see DefaultEntityProxyFactory
 * @see EntityFunctionResolver
 *
 */
public interface EntityProxyFactory {

    /**
     * Checks whether the supplied entity is a proxy.
     *
     * @param e
     *            Entity to check.
     * @return Whether the entity was a proxy.
     */
    boolean isProxyEntity(final Entity e);

    /**
     * Creates a proxy of the entity subclass.
     *
     * @param e
     *            Entity to proxy for.
     * @param type
     *            Type to proxy as.
     * @return The proxy.
     */
     T proxyOfEntity(Entity e, Class type);

    /**
     * Validates the type can be proxied.
     *
     * @param type
     *            Type to validate.
     */
    void validateType(Class type);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy