Package com.asakusafw.vocabulary.operator

Examples of com.asakusafw.vocabulary.operator.OperatorFactory


        assert operatorClass != null;
        assert methodName != null;
        assert portKind != null;
        assert portName != null;
        Class<?> factoryClass = findFactoryClass(operatorClass);
        OperatorFactory factory = factoryClass.getAnnotation(OperatorFactory.class);
        assert factory != null;
        Method factoryMethod = findFactoryMethod(factoryClass, methodName);
        OperatorInfo info = factoryMethod.getAnnotation(OperatorInfo.class);
        assert info != null;
        if (portKind == PortKind.INPUT) {
            boolean found = false;
            for (OperatorInfo.Input port : info.input()) {
                if (port.name().equals(portName)) {
                    found = true;
                    break;
                }
            }
            if (found == false) {
                List<String> list = new ArrayList<String>();
                for (OperatorInfo.Input port : info.input()) {
                    list.add(port.name());
                }
                throw new RewriteException(MessageFormat.format(
                        Messages.getString("TracepointWeaveRewriter.errorUnknownInputPort"), //$NON-NLS-1$
                        factoryClass.getName(),
                        factoryMethod.getName(),
                        portName,
                        list));
            }
        } else {
            boolean found = false;
            for (OperatorInfo.Output port : info.output()) {
                if (port.name().equals(portName)) {
                    found = true;
                    break;
                }
            }
            if (found == false) {
                List<String> list = new ArrayList<String>();
                for (OperatorInfo.Output port : info.output()) {
                    list.add(port.name());
                }
                throw new RewriteException(MessageFormat.format(
                        Messages.getString("TracepointWeaveRewriter.errorUnknownOutputPort"), //$NON-NLS-1$
                        factoryClass.getName(),
                        factoryMethod.getName(),
                        portName,
                        list));
            }
        }
        return new Tracepoint(factory.value().getName(), factoryMethod.getName(), portKind, portName);
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.vocabulary.operator.OperatorFactory

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.