If I'd like to talk to smb in real life, how do I learn who lives near me?
convertLists change the origin object...
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > Java Programming > convertLists change the origin object... 23 June 2005 17:47:41

  Top users: 
  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:

convertLists change the origin object...

Benoit MORAILLON 23 June 2005 17:47:41
 Hi everybody,
convertLists change the origin object by replacing
pojo<-> form
i would like to keep the origin object with forms and get the target
to be converted.
So i change the convertLists code as :

public static Object convertLists(Object­ o) throws Exception {
if (o == null) {
return null;
}

Object target = null;

PropertyDescriptor[] origDescriptors =
PropertyUtils.getPr­opertyDescriptors(o)­;

for (int i = 0; i < origDescriptors.len­gth; i++) {
String name = origDescriptors[i].get­Name();

if (origDescriptors[i].ge­tPropertyType().equa­ls(List.class)) {
List list = (List) PropertyUtils.getPr­operty(o, name);
List b = null;
if(list!=null)
b = new ArrayList(list.size­());
for (int j=0; j < list.size(); j++) {
Object origin = list.get(j);
// je convertit l'objet dans la liste
target = convert(origin);

b.set(j, target);
}
PropertyUtils.setPr­operty(o, name, b);
}
}
return o;
}
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > Java Programming > convertLists change the origin object... 23 June 2005 17:47:41

see also:
jboss-head-jdk-matrix build.253 Build…
Why does MBeanServerInvocationHandler…
[ jboss-Bugs-1230327 ]…
pass tests:
see also:
Full Guide: How to Enjoy Your Favorite…
How to convert AVCHD video
How to convert DVD and Video to AVI

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .