Package org.atmosphere.wasync

Examples of org.atmosphere.wasync.Function


        if (instanceType != null) {
            decodedObjects = matchDecoder(e, instanceType, decoders, decodedObjects);
        }

        for (FunctionWrapper wrapper : functions) {
            Function f = wrapper.function();
            Class<?>[] typeArguments = TypeResolver.resolveArguments(f.getClass(), Function.class);

            if (typeArguments == null) {
                logger.trace("Lambda function should not be used. Inferring type as String.class");
                typeArguments = new Class[]{String.class};
            }

            if (typeArguments.length > 0 && instanceType != null) {
                boolean b = false;
                if (decodedObjects.isEmpty()) {
                    implementedType = instanceType.getClass();
                    b = matchFunction(instanceType, typeArguments, implementedType, resolver, originalMessage, functionName, wrapper, f);
                } else {
                    for (Object o : decodedObjects) {
                        if (!Decoder.Decoded.class.isAssignableFrom(o.getClass())) {
                            b = matchFunction(o, typeArguments, o.getClass(), resolver, originalMessage, functionName, wrapper, f);
                        }
                    }
                }
                if (b) hasMatch = true;
            }
        }

        if (!hasMatch && !e.equals(Event.MESSAGE)) {
            // Since we have no match, most probably because a decoder isn't matching a function or the Event's type, try
            // to match Event type directly with a String.
            // This can happens if a decoder is not behaving properly.
            // instanceType != null because a ReplayDecoder may have interrupted
            for (FunctionWrapper wrapper : functions) {
                Function f = wrapper.function();
                if (wrapper.functionName().equalsIgnoreCase(functionName)) {
                    hasMatch = true;
                    logger.trace("{} .on {}", functionName, instanceType);
                    f.on(originalMessage);
                }
            }
        }

        return hasMatch;
View Full Code Here

TOP

Related Classes of org.atmosphere.wasync.Function

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.