<?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 Can I add Attribute with Mutable object to Immutable Graphic ? in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755935#M2251</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We would like to &lt;/SPAN&gt;&lt;STRONG&gt;associate some POJOs as Attributes of our &lt;A class="jive-link-external-small" href="https://developers.arcgis.com/en/java/api-reference/com/esri/core/map/Graphic.html" rel="nofollow" target="_blank"&gt;Graphics&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN&gt; with :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt; Graphic(Geometry geometry, Symbol symbol, &lt;STRONG&gt;Map&amp;lt;String,Object&amp;gt; attributes&lt;/STRONG&gt;, int drawOrder) &lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;However, &lt;/SPAN&gt;&lt;STRONG&gt;our POJOs are Mutable object&lt;/STRONG&gt;&lt;SPAN&gt;s with seem not to be compliant with &lt;/SPAN&gt;&lt;STRONG&gt;Immutable Graphic &lt;/STRONG&gt;&lt;SPAN&gt;concept (from API Ref.) :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt; "&lt;SPAN style="font-style:italic;"&gt;Graphic objects are immutable...&lt;/SPAN&gt;"&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; "&lt;SPAN style="font-style:italic;"&gt;getAttributes() returns all attributes of the graphic as a read-only collection.&lt;/SPAN&gt;"&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;STRONG&gt;So could somebody confirm to us, that using mutable objects as attributes values will not conflict with Graphic concept or behavior, as these mutable objects will be modified in parallel of their corresponding Graphic life cycle ?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;(we currently develop with ArcGIS Runtime for Java 10.1.1, but will soon move to 10.2)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Nov 2013 09:21:54 GMT</pubDate>
    <dc:creator>JeremieJoalland1</dc:creator>
    <dc:date>2013-11-25T09:21:54Z</dc:date>
    <item>
      <title>Can I add Attribute with Mutable object to Immutable Graphic ?</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755935#M2251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We would like to &lt;/SPAN&gt;&lt;STRONG&gt;associate some POJOs as Attributes of our &lt;A class="jive-link-external-small" href="https://developers.arcgis.com/en/java/api-reference/com/esri/core/map/Graphic.html" rel="nofollow" target="_blank"&gt;Graphics&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN&gt; with :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt; Graphic(Geometry geometry, Symbol symbol, &lt;STRONG&gt;Map&amp;lt;String,Object&amp;gt; attributes&lt;/STRONG&gt;, int drawOrder) &lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;However, &lt;/SPAN&gt;&lt;STRONG&gt;our POJOs are Mutable object&lt;/STRONG&gt;&lt;SPAN&gt;s with seem not to be compliant with &lt;/SPAN&gt;&lt;STRONG&gt;Immutable Graphic &lt;/STRONG&gt;&lt;SPAN&gt;concept (from API Ref.) :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt; "&lt;SPAN style="font-style:italic;"&gt;Graphic objects are immutable...&lt;/SPAN&gt;"&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; "&lt;SPAN style="font-style:italic;"&gt;getAttributes() returns all attributes of the graphic as a read-only collection.&lt;/SPAN&gt;"&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;STRONG&gt;So could somebody confirm to us, that using mutable objects as attributes values will not conflict with Graphic concept or behavior, as these mutable objects will be modified in parallel of their corresponding Graphic life cycle ?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;(we currently develop with ArcGIS Runtime for Java 10.1.1, but will soon move to 10.2)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2013 09:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755935#M2251</guid>
      <dc:creator>JeremieJoalland1</dc:creator>
      <dc:date>2013-11-25T09:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add Attribute with Mutable object to Immutable Graphic ?</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755936#M2252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There seems to be a bit of confusion here with the API Reference. This might be referring to graphic elements that come from non-editable FeatureServices. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you adding your own custom graphic elements with attributes and symbols to a normal GraphicsLayer? If so, these graphic elements are mutable, and your attributes are mutable. There should not be any problems here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The way your described what you want to do sounds like it will work fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Dec 2013 23:52:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755936#M2252</guid>
      <dc:creator>EricBader</dc:creator>
      <dc:date>2013-12-01T23:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add Attribute with Mutable object to Immutable Graphic ?</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755937#M2253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;There seems to be a bit of confusion here with the API Reference. This might be referring to graphic elements that come from non-editable FeatureServices.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;We are only refering to Graphic and GraphicsLayer, as we are drawing our own Point, Polyline and Polygon features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Are you adding your own custom graphic elements with attributes and symbols to a normal GraphicsLayer? If so, these graphic elements are mutable, and your attributes are mutable. There should not be any problems here.&lt;BR /&gt;The way your described what you want to do sounds like it will work fine.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes to your question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I disagree for mutable graphic elements, as the ArcGIS Javadoc says "&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Graphic objects are immutable, ...&lt;/SPAN&gt;&lt;SPAN&gt;" (-&amp;gt; please see the hyperlink on Graphic ion my first post).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From our tests, when we call Graphic Constructor and passes Attributes, it seems that Object from mutable Type are automatically converted to "String" type by calling .toString(). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So Attributes seems to manage only String, boolean and Numeric (Integer, Double...) types.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could ESRI confirm this point ? if Yes, the Javadoc could be improve to state the true behavior of Graphic and Attributes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 11:02:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755937#M2253</guid>
      <dc:creator>JeremieJoalland1</dc:creator>
      <dc:date>2013-12-02T11:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add Attribute with Mutable object to Immutable Graphic ?</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755938#M2254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Graphic is immutable - the attributes that you add are copied so you cannot change them throough a reference that you hold to the original attributes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once you have added a graphic to a GraphicsLayer you can use the returned ID to call update the on graphic - doing this will not change any instance of Graphic that you already hold. To get a Graphic instance with the updates you will have to call getGraphic using the ID which will give you a new graphic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally, although you can add any object to the attributes the underlying core code will only support the types allowed by ESRI servers e.g. numbers, strings, dates etc. This means that your object will be turned into a string by calling toString on it since it is not one of the recognised types.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 07:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755938#M2254</guid>
      <dc:creator>ColinAnderson1</dc:creator>
      <dc:date>2013-12-05T07:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add Attribute with Mutable object to Immutable Graphic ?</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755939#M2255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for these precisions, confirmed by our test code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be nice to have this documented in your API Reference/Javadoc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Dec 2013 08:44:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/can-i-add-attribute-with-mutable-object-to/m-p/755939#M2255</guid>
      <dc:creator>JeremieJoalland1</dc:creator>
      <dc:date>2013-12-19T08:44:32Z</dc:date>
    </item>
  </channel>
</rss>

