• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transform to child object  RSS feed

 
Jan Hoppmann
Ranch Hand
Posts: 147
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I have the following problem. I extend the class org.jboss.seam.security.Credentials with a class named ExtendedCredentials (code below). What I want to do is use an existing Credentials object and transform it to an ExtendedCredentials object. Is this possible without giving the constructor of ExtendedCredentials the existing object and copy each value by hand?

 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately not. Well there is, but that would be to pass all values separately to the constructor. Passing the object is better.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But why don't you just outject the value into the session scope in your authenticate-method or in a @Observer("org.jboss.seam.security.loginSuccessful") method
 
Jan Hoppmann
Ranch Hand
Posts: 147
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's because I need an application scoped list with weak references to the currently logged in users - it's so the sysadmins see who's still logged in when they shut down the server ;)
I now redesigned my classes a bit and store the Credentials object in a weak reference object in my ExtendedCredentials class. Works fine
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!