You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Vikas Mayur <vi...@hotwaxmedia.com> on 2009/04/09 12:08:44 UTC
Purpose of type=PlainString
Hi,
While doing a commit in rev. 763582 for OFBIZ-2281, I come across a
type=PlainString which I think is the only occurrence in all of the
xml files. While fixing this issue, I have to remove the <set> tag
that has this type.
> - <set field="newEntity.returnItemSeqId" from-
> field="newestItem.returnItemSeqId" type="PlainString"/>
Certainly this has nothing to do with my fix but I was still
interested in knowing what is this type is all about. I hope I have
not done any thing silly with my fix by removing the above line
because after my fix that line wasn't used anymore.
Please shed any light on this topic.
Thanks,
Vikas
Re: Purpose of type=PlainString
Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Divesh
The difference between the two becomes evident when you are dealing
with numbers and dates, as mentioned below PlainString simply returns
object.toString() but String does more than that and attempts to
format the string that it returns where applicable. Here are some
examples of what String does (straight out of
ObjectType.simpleTypeConvert where all this is done):
For Double, Float, Long, Integer and BigDecimal:
NumberFormat nf = NumberFormat.getNumberInstance(locale);
return nf.format(dbl.doubleValue());
For Date
DateFormat df = null;
if (format == null || format.length() == 0) {
df = UtilDateTime.toDateFormat(UtilDateTime.DATE_FORMAT,
timeZone, locale);
} else {
df = UtilDateTime.toDateFormat(format, timeZone, locale);
}
return df.format(new java.util.Date(dte.getTime()));
For Time and Timestamp
DateFormat df = null;
if (format == null || format.length() == 0) {
df = UtilDateTime.toTimeFormat(UtilDateTime.TIME_FORMAT,
timeZone, locale);
} else {
df = UtilDateTime.toTimeFormat(format, timeZone, locale);
}
return df.format(new java.util.Date(tme.getTime()));
TimeZone returns getID()
Buffer throws an exception
Boolean, Locale, GenericValue, Map, List and anything else not
mentioned above return toString()
Regards
Scott
HotWax Media
http://www.hotwaxmedia.com
On 9/04/2009, at 11:48 PM, Divesh Dutta wrote:
> Thanks Scott for your explanation. But I am confused that ,<set
> field="newEntity.returnItemSeqId" from-
> field="newestItem.returnItemSeqId" type="String"/> also serves the
> same purpose. Is there any other reason for using PlainString . Is
> it like using String or PlainString will serve the same purpose?
>
> Thanks
> Divesh
>
>
> Scott Gray wrote:
>> Hi Vikas
>>
>> PlainString just sets the field value to fromField.toString()
>>
>> Regards
>> Scott
>>
>> On 9/04/2009, at 10:08 PM, Vikas Mayur wrote:
>>
>>> Hi,
>>>
>>> While doing a commit in rev. 763582 for OFBIZ-2281 <https://issues.apache.org/jira/browse/OFBIZ-2281
>>> >, I come across a type=PlainString which I think is the only
>>> occurrence in all of the xml files. While fixing this issue, I
>>> have to remove the <set> tag that has this type.
>>>> - <set field="newEntity.returnItemSeqId" from-
>>>> field="newestItem.returnItemSeqId" type="PlainString"/>
>>>
>>> Certainly this has nothing to do with my fix but I was still
>>> interested in knowing what is this type is all about. I hope I
>>> have not done any thing silly with my fix by removing the above
>>> line because after my fix that line wasn't used anymore.
>>>
>>> Please shed any light on this topic.
>>>
>>> Thanks,
>>> Vikas
>>
>
Re: Purpose of type=PlainString
Posted by Divesh Dutta <di...@hotwaxmedia.com>.
Thanks Scott for your explanation. But I am confused that ,<set
field="newEntity.returnItemSeqId"
from-field="newestItem.returnItemSeqId" type="String"/> also serves the
same purpose. Is there any other reason for using PlainString . Is it
like using String or PlainString will serve the same purpose?
Thanks
Divesh
Scott Gray wrote:
> Hi Vikas
>
> PlainString just sets the field value to fromField.toString()
>
> Regards
> Scott
>
> On 9/04/2009, at 10:08 PM, Vikas Mayur wrote:
>
>> Hi,
>>
>> While doing a commit in rev. 763582 for OFBIZ-2281
>> <https://issues.apache.org/jira/browse/OFBIZ-2281>, I come across a
>> type=PlainString which I think is the only occurrence in all of the
>> xml files. While fixing this issue, I have to remove the <set> tag
>> that has this type.
>>
>>> - <set field="newEntity.returnItemSeqId"
>>> from-field="newestItem.returnItemSeqId" type="PlainString"/>
>>
>> Certainly this has nothing to do with my fix but I was
>> still interested in knowing what is this type is all about. I hope I
>> have not done any thing silly with my fix by removing the above line
>> because after my fix that line wasn't used anymore.
>>
>> Please shed any light on this topic.
>>
>> Thanks,
>> Vikas
>
Re: Purpose of type=PlainString
Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Vikas
PlainString just sets the field value to fromField.toString()
Regards
Scott
On 9/04/2009, at 10:08 PM, Vikas Mayur wrote:
> Hi,
>
> While doing a commit in rev. 763582 for OFBIZ-2281, I come across a
> type=PlainString which I think is the only occurrence in all of the
> xml files. While fixing this issue, I have to remove the <set> tag
> that has this type.
>
>> - <set field="newEntity.returnItemSeqId" from-
>> field="newestItem.returnItemSeqId" type="PlainString"/>
>
> Certainly this has nothing to do with my fix but I was still
> interested in knowing what is this type is all about. I hope I have
> not done any thing silly with my fix by removing the above line
> because after my fix that line wasn't used anymore.
>
> Please shed any light on this topic.
>
> Thanks,
> Vikas