<?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 Defining a static variable in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Defining-a-static-variable/m-p/2195714#M191</link>
    <description>&lt;P&gt;I want to create a static variable that I can initialize once and then re-use. There are a few places I want to do this - a compiled regular expression, a SimpleDateFormat, there are a number of objects in Java that are useful to create once and re-use.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;At the moment I am creating the objects in a tJava component and pushing them into the globalMap or a&amp;nbsp;&lt;A href="https://www.talendbyexample.com/talend-returning-values-from-subjobs.html" target="_self" rel="nofollow noopener noreferrer"&gt;sharedMap&lt;/A&gt; object. That means that every time I access one of them, I have to pull it out of the map and cast it to the right class.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Is there a better way of doing this?&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:56:02 GMT</pubDate>
    <dc:creator>PhilHibbs</dc:creator>
    <dc:date>2024-11-16T03:56:02Z</dc:date>
    <item>
      <title>Defining a static variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Defining-a-static-variable/m-p/2195714#M191</link>
      <description>&lt;P&gt;I want to create a static variable that I can initialize once and then re-use. There are a few places I want to do this - a compiled regular expression, a SimpleDateFormat, there are a number of objects in Java that are useful to create once and re-use.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;At the moment I am creating the objects in a tJava component and pushing them into the globalMap or a&amp;nbsp;&lt;A href="https://www.talendbyexample.com/talend-returning-values-from-subjobs.html" target="_self" rel="nofollow noopener noreferrer"&gt;sharedMap&lt;/A&gt; object. That means that every time I access one of them, I have to pull it out of the map and cast it to the right class.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Is there a better way of doing this?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:56:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Defining-a-static-variable/m-p/2195714#M191</guid>
      <dc:creator>PhilHibbs</dc:creator>
      <dc:date>2024-11-16T03:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a static variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Defining-a-static-variable/m-p/2195715#M192</link>
      <description>&lt;P&gt;I solved my problem by creating a code entry like this:&lt;/P&gt;&lt;PRE&gt;public class statics_for_phil {
    public static java.text.SimpleDateFormat format_YYYYMMDD;
    
    public static java.util.regex.Pattern    file_name_split;
    
    static {
        format_YYYYMMDD = new java.text.SimpleDateFormat("yyyyMMdd");
        file_name_split = java.util.regex.Pattern.compile("^S3_(\\d+)_([a-z]+)_(\\d+)");
    }
    
}&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 11:08:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Defining-a-static-variable/m-p/2195715#M192</guid>
      <dc:creator>PhilHibbs</dc:creator>
      <dc:date>2019-12-04T11:08:03Z</dc:date>
    </item>
  </channel>
</rss>

