You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by rolfst <ro...@gmail.com> on 2009/09/25 10:22:42 UTC

is it possilble to construct domain object w/o using default constructor?

Hi s it possilble to construct a domain object w/o using default constructor
or using a dto?
or using @Inject because I dont have access to the domain object sources. so
i cant use @inject and other wise i get an exception about not having an
interface for java.lang.String 

thanks,
rolfst
-- 
View this message in context: http://www.nabble.com/is-it-possilble-to-construct-domain-object-w-o-using-default-constructor--tp25608302p25608302.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: is it possilble to construct domain object w/o using default constructor?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 28 Sep 2009 11:07:23 -0300, rolfst <ro...@gmail.com> escreveu:

> ok its not exactly what i want.
> let me explain.
>
> my objects are retrieved from the database and i want to update them.
> now these objects have a default constructor and a convenient constructor
> with a parameter for id and name and extra values.
>
> when i want to update now i get an exception. because of this extra
> constructor.

Just use the Form and BeanEditForm prepare event to instantiate the
object yourself:

@OnEvent(EventConstants.PREPARE)
public void prepareObject() {
	if (editedObject == null) {
		editedObject = new ....
	}
}

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: is it possilble to construct domain object w/o using default constructor?

Posted by rolfst <ro...@gmail.com>.
ok its not exactly what i want.
let me explain.

my objects are retrieved from the database and i want to update them.
now these objects have a default constructor and a convenient constructor
with a parameter for id and name and extra values.

when i want to update now i get an exception. because of this extra
constructor. 



Thiago H. de Paula Figueiredo wrote:
> 
> Em Fri, 25 Sep 2009 09:35:31 -0300, rolfst <ro...@gmail.com> escreveu:
> 
>> Hi I am trying to use my domain model objects in a beaneditor.
>> the backend is constructed and serviced by spring.
> 
> Just use the Form and BeanEditForm prepare event to instantiate the object  
> yourself:
> 
> @OnEvent(EventConstants.PREPARE)
> public void prepareObject() {
> 	if (editedObject == null) {
> 		editedObject = new ....
> 	}
> }
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/is-it-possilble-to-construct-domain-object-w-o-using-default-constructor--tp25608302p25645387.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: is it possilble to construct domain object w/o using default constructor?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 25 Sep 2009 09:35:31 -0300, rolfst <ro...@gmail.com> escreveu:

> Hi I am trying to use my domain model objects in a beaneditor.
> the backend is constructed and serviced by spring.

Just use the Form and BeanEditForm prepare event to instantiate the object  
yourself:

@OnEvent(EventConstants.PREPARE)
public void prepareObject() {
	if (editedObject == null) {
		editedObject = new ....
	}
}

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: is it possilble to construct domain object w/o using default constructor?

Posted by rolfst <ro...@gmail.com>.
Hi I am trying to use my domain model objects in a beaneditor.
the backend is constructed and serviced by spring.


Thiago H. de Paula Figueiredo wrote:
> 
> Em Fri, 25 Sep 2009 05:22:42 -0300, rolfst <ro...@gmail.com> escreveu:
> 
>> Hi s it possilble to construct a domain object w/o using default  
>> constructor or using a dto?
> 
> Do you mean to use it as a Tapestry-IoC service? Or using it in a  
> BeanEditor or BeanEditForm?
> 
>> or using @Inject because I dont have access to the domain object  
>> sources. so i cant use @inject and other wise i get an exception about  
>> not having an
>> interface for java.lang.String
> 
> Create a service builder method for it:  
> http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/is-it-possilble-to-construct-domain-object-w-o-using-default-constructor--tp25608302p25611386.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: is it possilble to construct domain object w/o using default constructor?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 25 Sep 2009 05:22:42 -0300, rolfst <ro...@gmail.com> escreveu:

> Hi s it possilble to construct a domain object w/o using default  
> constructor or using a dto?

Do you mean to use it as a Tapestry-IoC service? Or using it in a  
BeanEditor or BeanEditForm?

> or using @Inject because I dont have access to the domain object  
> sources. so i cant use @inject and other wise i get an exception about  
> not having an
> interface for java.lang.String

Create a service builder method for it:  
http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org