public static List<DataType> createTypes(PhysicalOperation physicalOperation) throws Fabric3Exception { List<DataType> dataTypes = new ArrayList<>(); if (!physicalOperation.getSourceParameterTypes().isEmpty()) { List<Class<?>> types = physicalOperation.getSourceParameterTypes(); dataTypes.addAll(types.stream().map(type -> new JavaType((type))).collect(Collectors.toList())); } return dataTypes; }
@SuppressWarnings({"unchecked"}) private List<DataType> createTypes(PhysicalOperation physicalOperation) throws Fabric3Exception { List<DataType> dataTypes = new ArrayList<>(); if (physicalOperation.getSourceParameterTypes().isEmpty()) { // no params dataTypes.add(EMPTY_TYPE); } else { List<Class<?>> types = physicalOperation.getSourceParameterTypes(); dataTypes.addAll(types.stream().map(type -> new JavaType((type))).collect(Collectors.toList())); } return dataTypes; }
/** * Returns the matching method from the class for a given operation. * * @param clazz the class to introspect * @param operation the operation to match * @return a matching method * @throws NoSuchMethodException if a matching method is not found * @throws ClassNotFoundException if a parameter type specified in the operation is not found */ private Method findMethod(Class<?> clazz, PhysicalOperation operation) throws NoSuchMethodException, ClassNotFoundException { String name = operation.getName(); List<Class<?>> params = operation.getSourceParameterTypes(); return clazz.getMethod(name, params.toArray(new Class[params.size()])); }
/** * Returns the matching method from the class for a given operation. * * @param clazz the class to introspect * @param operation the operation to match * @return a matching method * @throws NoSuchMethodException if a matching method is not found * @throws ClassNotFoundException if a parameter type specified in the operation is not found */ private Method findMethod(Class<?> clazz, PhysicalOperation operation) throws NoSuchMethodException, ClassNotFoundException { String name = operation.getName(); List<Class<?>> params = operation.getSourceParameterTypes(); return clazz.getMethod(name, params.toArray(new Class[params.size()])); }
public void attach(PhysicalWireSource source, SystemWireTarget target, Wire wire) throws Fabric3Exception { URI targetId = UriHelper.getDefragmentedName(target.getUri()); SystemComponent targetComponent = (SystemComponent) manager.getComponent(targetId); Class<?> implementationClass = targetComponent.getImplementationClass(); for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation operation = chain.getPhysicalOperation(); List<Class<?>> params = operation.getSourceParameterTypes(); Method method; try { method = implementationClass.getMethod(operation.getName(), params.toArray(new Class[params.size()])); } catch (NoSuchMethodException e) { throw new Fabric3Exception("No matching method found", e); } SystemInvokerInterceptor interceptor = new SystemInvokerInterceptor(method, targetComponent); chain.addInterceptor(interceptor); } }
ClassLoader sourceLoader) throws Fabric3Exception { List<Class<?>> targetTypes = definition.getTargetParameterTypes(); List<Class<?>> sourceTypes = definition.getSourceParameterTypes();
ClassLoader sourceLoader) throws Fabric3Exception { List<Class<?>> targetTypes = definition.getTargetParameterTypes(); List<Class<?>> sourceTypes = definition.getSourceParameterTypes();