Package com.github.overengineer.container.key

Examples of com.github.overengineer.container.key.Key


    }

    private void initCache() {
        delegateInvokerCache = new HashMap<Method, ServiceDelegateInvoker>();
        for (Method serviceMethod : serviceInterface.getDeclaredMethods()) {
            Key delegateKey = metadataAdapter.getDelegateKey(serviceMethod);
            Class<?> delegateClass = delegateKey.getTargetClass();
            Class[] providedArgs = serviceMethod.getParameterTypes();
            Method delegateMethod = null;
            for (Method delegateCandidateMethod : delegateClass.getDeclaredMethods()) {
                //TODO make the provided arg matching injectable to match different parameter builders
                if (delegateCandidateMethod.getName().equals(serviceMethod.getName()) && ParameterMatchingUtil.precedingMatch(providedArgs, delegateCandidateMethod.getParameterTypes())) {
View Full Code Here


    @SuppressWarnings("unchecked")
    @Override
    public synchronized  <T> void swap(Class<T> target, Class<? extends T> implementationType) throws HotSwapException {

        Key targetKey = Locksmith.makeKey(target);

        ComponentStrategy<T> currentStrategy = (ComponentStrategy<T>) getStrategy(targetKey);

        if (!(currentStrategy instanceof HotSwappableProxyStrategy)) {
            throw new HotSwapException(target, currentStrategy.getComponentType(), implementationType);
        }

        ComponentProxyHandler<T> proxyHandler = ((HotSwappableProxyStrategy) currentStrategy).getProxyHandler();

        ComponentStrategy<T> newStrategy = (ComponentStrategy<T>) strategyFactory.create(implementationType, targetKey.getQualifier(), Scopes.SINGLETON);

        if (!(newStrategy instanceof HotSwappableProxyStrategy)) {
            throw new HotSwapException(target, newStrategy.getComponentType(), implementationType);
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected  <T> ParameterProxy<T> createProxy(Class<?> injectionTarget, ParameterRef parameterRef, Annotation[] annotations) {

        Type parameterType = parameterRef.getType();

        Key key = Locksmith.makeKey(parameterRef, metadataAdapter.getQualifier(parameterType, annotations));

        if (KeyUtil.getClass(parameterType).isAssignableFrom(injectionTarget)) {
            return new DecoratorParameterProxy<T>(key, injectionTarget);
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public synchronized  <T, I extends T> void swap(Class<T> target, I implementation) throws HotSwapException {

        Key targetKey = Locksmith.makeKey(target);

        ComponentStrategy<T> currentStrategy = (ComponentStrategy<T>) getStrategy(targetKey);

        if (!(currentStrategy instanceof HotSwappableProxyStrategy)) {
            throw new HotSwapException(target, currentStrategy.getComponentType(), implementation.getClass());
        }

        ComponentProxyHandler<T> proxyHandler = ((HotSwappableProxyStrategy) currentStrategy).getProxyHandler();

        ComponentStrategy<T> newStrategy = (ComponentStrategy<T>) strategyFactory.createInstanceStrategy(implementation, targetKey.getQualifier());

        if (!(newStrategy instanceof HotSwappableProxyStrategy)) {
            throw new HotSwapException(target, newStrategy.getComponentType(), implementation.getClass());
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected  <T> ParameterProxy<T> createProxy(Class<?> injectionTarget, ParameterRef parameterRef, Annotation[] annotations) {

        Type parameterType = parameterRef.getType();

        Key key = Locksmith.makeKey(parameterRef, metadataAdapter.getQualifier(parameterType, annotations));

        if (KeyUtil.getClass(parameterType).isAssignableFrom(injectionTarget)) {
            return new DecoratorParameterProxy<T>(key, injectionTarget);
        }
View Full Code Here

TOP

Related Classes of com.github.overengineer.container.key.Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.