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

org.marketcetera.strategy.Language Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package org.marketcetera.strategy;

import java.lang.reflect.Constructor;

import org.marketcetera.core.ClassVersion;

/* $License$ */

/**
 * Defines the set of strategy languages available.
 *
 * @author Colin DuPlantis
 * @version $Id: Language.java 16154 2012-07-14 16:34:05Z colin $
 * @since 1.0.0
 */
@ClassVersion("$Id: Language.java 16154 2012-07-14 16:34:05Z colin $")
public enum Language
{
    /**
     * represents a Ruby strategy
     */
    RUBY(RubyExecutor.class),
    /**
     * represents a Java strategy
     */
    JAVA(JavaExecutor.class);
    /**
     * the executor to use to execute strategies of this type
     */
    private final Class executorClass;
    /**
     * Returns an executor to use to execute a strategy implemented in this Language.
     *
     * 

Each invocation of this method is guaranteed to return a unique instance of the given Executor. * * @return an Executor value */ Executor getExecutor(Strategy inStrategy) throws Exception { Constructor constructor = executorClass.getDeclaredConstructor(Strategy.class); constructor.setAccessible(true); return constructor.newInstance(inStrategy); } /** * Create a new Language instance. * * @param inExecutor a Class<? extends Executor> value */ private Language(Class inExecutor) { executorClass = inExecutor; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy