Expand my Community achievements bar.

SOLVED

Very odd behavior regarding variable naming with DataService.fill()

Avatar

Level 2
I'm experiencing this odd behavior in LCDS 2.5, wich pertains
to variable naming for the objects returned by a DataService.fill()
call. I ceated a simple destination with a Java adapter. the Server
side Java data object is defined as follows)



package test;



public class RepositoryObject

{

private String m_strObjectId;

private boolean m_bIsValid;

private long m_lSize;



[public setters and getters here]

}



On Flex side, the ActionScript value object is defined as
follows:



package test

{

[Bindable]

[RemoteClass(alias="test.RepositoryObject")]

public class RepositoryObject

{



public var m_strObjectId:String;

public var m_bIsValid:Boolean;

public var m_lSize:Number;



public function RepositoryObject()

{

}



}

}



The FDS destination definition (in
data-management-config.xml):



<destination id="testDs">



<adapter ref="java-dao" />



<properties>



<source>test.TestDS</source>

<scope>application</scope>



<metadata>

<identity property="m_strObjectId"/>

</metadata>



<network>

<session-timeout>20</session-timeout>

<paging enabled="false" pageSize="10" />

<throttle-inbound policy="ERROR" max-frequency="500"/>

<throttle-outbound policy="REPLACE"
max-frequency="500"/>

</network>



<server>

<fill-method>

<name>getObjects</name>

</fill-method>

</server>

</properties>

</destination>



What I figured while debugging into the client was is the
data returned by the service (I'm using the mx:DataService call)
returns objects whose variable names
do not match my definition:



m_strObjectId becomes objectId

m_lSize becomes size

m_bIsValid becomes isValid



I wonder why that renaming??? Basically "m_str" prefix was
stripped and capital "O" became lower case "o" for my first
variable etc.



For instance, in a datagrid cell renderer I could not
reference the returned value as {data.m_strObjectId}, but if I use
{data.objectId}, it works.



Any ideas why this behavior (which I found confusing and odd)
would be greately appreciated.

Robert
1 Accepted Solution

Avatar

Correct answer by
Former Community Member
How do you define your getters and setters? For example, for
m_strObjectId variable, do you have getM_strObjectId as getter or
do you have getObjectId as getter? I suspect the latter.

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member
How do you define your getters and setters? For example, for
m_strObjectId variable, do you have getM_strObjectId as getter or
do you have getObjectId as getter? I suspect the latter.

Avatar

Level 2
The latter, as "getM_strObjectId " is an ugly name... don't
tell me that causes issue...ok kidding, I got you. The
setter/getter names are important in this context.



Thanks a lot.

Robert
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----