<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: defining a class in routines &amp; instantiate it in tJava without static functions in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/defining-a-class-in-routines-instantiate-it-in-tJava-without/m-p/2364111#M127906</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Talend Studio allows you to store frequently used parts of code or extract parts of existing functions and then call them via routines. You can call a routine many times from within the same Job or from more than one of your Jobs.&lt;/P&gt;&lt;P&gt;public static void main(..)&lt;/P&gt;&lt;P&gt;You can call any function in any of the system and user routines from your Job components in order to run them at the same time as your Job.&lt;/P&gt;&lt;P&gt;To access all routine functions, press Ctrl+Space in any of the fields in the Basic settings view of a component used in your Job and select the one you want to use from the list displayed.&lt;/P&gt;&lt;P&gt;​As the first triggered method is usually, "&lt;I&gt;public static void main(..)&lt;/I&gt;", with your requirement that &lt;B&gt;non-static &lt;/B&gt;functions in routines, could you please elaborate your case with an example?&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Sabrina&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2023 06:11:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-11-15T06:11:38Z</dc:date>
    <item>
      <title>defining a class in routines &amp; instantiate it in tJava without static functions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/defining-a-class-in-routines-instantiate-it-in-tJava-without/m-p/2364110#M127905</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I wonder if I can create a class with &lt;B&gt;non-static functions&lt;/B&gt; (in routines) and instantiate an instance of  the class in a t_java component &amp;amp; use its functions?&lt;/P&gt;&lt;P&gt;I'm not sure if this is considered good practice or even a valid one. However, I have a code that is used in multiple jobs with slight variations, and I believe applying the factory design pattern would be the most suitable solution for this.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:15:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/defining-a-class-in-routines-instantiate-it-in-tJava-without/m-p/2364110#M127905</guid>
      <dc:creator>H1694942638</dc:creator>
      <dc:date>2024-11-15T21:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: defining a class in routines &amp; instantiate it in tJava without static functions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/defining-a-class-in-routines-instantiate-it-in-tJava-without/m-p/2364111#M127906</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Talend Studio allows you to store frequently used parts of code or extract parts of existing functions and then call them via routines. You can call a routine many times from within the same Job or from more than one of your Jobs.&lt;/P&gt;&lt;P&gt;public static void main(..)&lt;/P&gt;&lt;P&gt;You can call any function in any of the system and user routines from your Job components in order to run them at the same time as your Job.&lt;/P&gt;&lt;P&gt;To access all routine functions, press Ctrl+Space in any of the fields in the Basic settings view of a component used in your Job and select the one you want to use from the list displayed.&lt;/P&gt;&lt;P&gt;​As the first triggered method is usually, "&lt;I&gt;public static void main(..)&lt;/I&gt;", with your requirement that &lt;B&gt;non-static &lt;/B&gt;functions in routines, could you please elaborate your case with an example?&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Sabrina&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 06:11:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/defining-a-class-in-routines-instantiate-it-in-tJava-without/m-p/2364111#M127906</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-15T06:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: defining a class in routines &amp; instantiate it in tJava without static functions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/defining-a-class-in-routines-instantiate-it-in-tJava-without/m-p/2364112#M127907</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi @Xiaodi Shi​&amp;nbsp; (Sabrina)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt; with your requirement that non-static functions in routines, could you please elaborate your case with an example?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to achieve the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have multiple jobs with redundant code. The routines called at each job are mostly the same but with different variations. This redundancy can be reduced by introducing a class, for example, "Processor," with a function called "run" that can call different methods based on the given arguments.&lt;/P&gt;&lt;P&gt;Ultimately, in each job, I need a tJavaComponent that should include these two lines or more:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Processor x = new Processor(...);&lt;/P&gt;&lt;P&gt;Double output = x.run();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 07:39:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/defining-a-class-in-routines-instantiate-it-in-tJava-without/m-p/2364112#M127907</guid>
      <dc:creator>H1694942638</dc:creator>
      <dc:date>2023-11-15T07:39:43Z</dc:date>
    </item>
  </channel>
</rss>

