@Test void flowFactory() { final FlowsFactory factory = extension .unwrap(FlowsFactory.class, new ComponentFamilyMeta.ProcessorMeta( new ComponentFamilyMeta("test", emptyList(), null, "test", "test"), "beam", null, 1, BeamMapper.class, Collections::emptyList, null, null, true) { }); assertEquals(1, factory.getInputFlows().size()); assertEquals(asList("main1", "main2"), factory.getOutputFlows()); }
@Override public <T> T unwrap(final Class<T> type, final Object... args) { if ("org.talend.sdk.component.design.extension.flows.FlowsFactory".equals(type.getName()) && args != null && args.length == 1 && ComponentFamilyMeta.BaseMeta.class.isInstance(args[0])) { if (ComponentFamilyMeta.ProcessorMeta.class.isInstance(args[0])) { try { final FlowsFactory factory = FlowsFactory.get(ComponentFamilyMeta.BaseMeta.class.cast(args[0])); factory.getOutputFlows(); return type.cast(factory); } catch (final Exception e) { return type.cast(BeamFlowFactory.OUTPUT); } } } if (type.isInstance(this)) { return type.cast(this); } return null; }
BeamComponentExtension implements ComponentExtension { @Override public <T> T unwrap(final Class<T> type, final Object... args) { if ("org.talend.sdk.component.design.extension.flows.FlowsFactory".equals(type.getName()) && args != null && args.length == 1 && ComponentFamilyMeta.BaseMeta.class.isInstance(args[0])) { if (ComponentFamilyMeta.ProcessorMeta.class.isInstance(args[0])) { try { final FlowsFactory factory = FlowsFactory.get(ComponentFamilyMeta.BaseMeta.class.cast(args[0])); factory.getOutputFlows(); return type.cast(factory); } catch (final Exception e) { return type.cast(BeamFlowFactory.OUTPUT); } } } if (type.isInstance(this)) { return type.cast(this); } return null; } }
BeamComponentExtension implements ComponentExtension { @Override public <T> T unwrap(final Class<T> type, final Object... args) { if ("org.talend.sdk.component.design.extension.flows.FlowsFactory".equals(type.getName()) && args != null && args.length == 1 && ComponentFamilyMeta.BaseMeta.class.isInstance(args[0])) { if (ComponentFamilyMeta.ProcessorMeta.class.isInstance(args[0])) { try { final FlowsFactory factory = FlowsFactory.get(ComponentFamilyMeta.BaseMeta.class.cast(args[0])); factory.getOutputFlows(); return type.cast(factory); } catch (final Exception e) { return type.cast(BeamFlowFactory.OUTPUT); } } } if (type.isInstance(this)) { return type.cast(this); } return null; }  }
BeamComponentExtension implements ComponentExtension { @Override public <T> T unwrap(final Class<T> type, final Object... args) { if ("org.talend.sdk.component.design.extension.flows.FlowsFactory".equals(type.getName()) && args != null && args.length == 1 && ComponentFamilyMeta.BaseMeta.class.isInstance(args[0])) { if (ComponentFamilyMeta.ProcessorMeta.class.isInstance(args[0])) { try { final FlowsFactory factory = FlowsFactory.get(ComponentFamilyMeta.BaseMeta.class.cast(args[0])); factory.getOutputFlows(); return type.cast(factory); } catch (final Exception e) { return type.cast(BeamFlowFactory.OUTPUT); } } } if (type.isInstance(this)) { return type.cast(this); } return null; }  @Override boolean isActive(); @Override T unwrap(final Class<T> type, final Object... args); @Override Collection<ClassFileTransformer> getTransformers(); @Override void onComponent(final ComponentContext context); @Override boolean supports(final Class<?> componentType); @Override Map<Class<?>, Object> getExtensionServices(final String plugin); @Override T convert(final ComponentInstance instance, final Class<T> component); @Override Collection<String> getAdditionalDependencies(); }
BeamComponentExtension implements ComponentExtension { @Override public <T> T unwrap(final Class<T> type, final Object... args) { if ("org.talend.sdk.component.design.extension.flows.FlowsFactory".equals(type.getName()) && args != null && args.length == 1 && ComponentFamilyMeta.BaseMeta.class.isInstance(args[0])) { if (ComponentFamilyMeta.ProcessorMeta.class.isInstance(args[0])) { try { final FlowsFactory factory = FlowsFactory.get(ComponentFamilyMeta.BaseMeta.class.cast(args[0])); factory.getOutputFlows(); return type.cast(factory); } catch (final Exception e) { return type.cast(BeamFlowFactory.OUTPUT); } } } if (type.isInstance(this)) { return type.cast(this); } return null; }  @Override boolean isActive(); @Override T unwrap(final Class<T> type, final Object... args); @Override Collection<ClassFileTransformer> getTransformers(); @Override void onComponent(final ComponentContext context); @Override boolean supports(final Class<?> componentType); @Override Map<Class<?>, Object> getExtensionServices(final String plugin); @Override T convert(final ComponentInstance instance, final Class<T> component); @Override Collection<String> getAdditionalDependencies();  }