TypeConverters and the declare type.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

TypeConverters and the declare type.

Robert Nicholson-3
I'm still new to stripes but last week I had an issue where it wasn't using the correct type convertor on a binding.

So I  have a hibernate object that has an attribute represented as a varchar in the database and it's java type is a String

However I wanted to filter based on a type of Enum.

The code I saw seemed to go looking at the declared type of the attribute in order to figure out what kind of type converter should apply and so instead of end up with an Enum converter it arrives at a String converter.

How can you override this behavior?

My final solution was to do away with the Enum completely which means I had to display the value as "Y" "N" instead of "True" "False"



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: TypeConverters and the declare type.

VANKEISBELCK Remi
Hi Robert,

If the declared type is 

2013/3/16 Robert Nicholson <[hidden email]>
I'm still new to stripes but last week I had an issue where it wasn't using the correct type convertor on a binding.

So I  have a hibernate object that has an attribute represented as a varchar in the database and it's java type is a String

However I wanted to filter based on a type of Enum.

The code I saw seemed to go looking at the declared type of the attribute in order to figure out what kind of type converter should apply and so instead of end up with an Enum converter it arrives at a String converter.

How can you override this behavior?

My final solution was to do away with the Enum completely which means I had to display the value as "Y" "N" instead of "True" "False"



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: TypeConverters and the declare type.

VANKEISBELCK Remi
Hi Robert, 

If the declared type is String the Stripes will bind to a String. If you wanna use an enum in the bean you can just do that.

What do you mean by "filter" ?

Cheers

Remi   

2013/3/16 VANKEISBELCK Remi <[hidden email]>
Hi Robert,

If the declared type is 


2013/3/16 Robert Nicholson <[hidden email]>
I'm still new to stripes but last week I had an issue where it wasn't using the correct type convertor on a binding.

So I  have a hibernate object that has an attribute represented as a varchar in the database and it's java type is a String

However I wanted to filter based on a type of Enum.

The code I saw seemed to go looking at the declared type of the attribute in order to figure out what kind of type converter should apply and so instead of end up with an Enum converter it arrives at a String converter.

How can you override this behavior?

My final solution was to do away with the Enum completely which means I had to display the value as "Y" "N" instead of "True" "False"



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: TypeConverters and the declare type.

Robert Nicholson-3
In my case the bean is the actual JPA hibernate class and so it's modeled as a String.

However, some extensions were written on top of Display Tag to provide filtering ie. searching whereby a textfield or popup is added as the header of each column. The idea is that it's suppose to populate an "example" object who's state is then used to perform the search. 

The example object is also an instance of the JPA hibernate class.

It just didn't seem like there was any way to override the actual declared type of the thing I'm searching by. There was no way to cover or annotate that I wanted to use an Enum to represent what I'm displaying to my user. Display value A but search using value B.

On Mar 16, 2013, at 4:26 AM, VANKEISBELCK Remi <[hidden email]> wrote:

Hi Robert, 

If the declared type is String the Stripes will bind to a String. If you wanna use an enum in the bean you can just do that.

What do you mean by "filter" ?

Cheers

Remi   

2013/3/16 VANKEISBELCK Remi <[hidden email]>
Hi Robert,

If the declared type is 


2013/3/16 Robert Nicholson <[hidden email]>
I'm still new to stripes but last week I had an issue where it wasn't using the correct type convertor on a binding.

So I  have a hibernate object that has an attribute represented as a varchar in the database and it's java type is a String

However I wanted to filter based on a type of Enum.

The code I saw seemed to go looking at the declared type of the attribute in order to figure out what kind of type converter should apply and so instead of end up with an Enum converter it arrives at a String converter.

How can you override this behavior?

My final solution was to do away with the Enum completely which means I had to display the value as "Y" "N" instead of "True" "False"



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: TypeConverters and the declare type.

VANKEISBELCK Remi
I don't get it. 

You mean you have an action bean that references an object (JPA) and you want to bind a string to one of its props ?

action -> pojo -> String ?

What's display tag have to do with it ?

In all cases, Stripes binds request params using the declared type of the property. You can change this by supplying your own TypeConverter, in the @Validate annotation (can be nested, using @ValidateNestedProperties).

HTH

Remi

Le 18 mars 2013 à 15:18, Robert Nicholson a écrit :

In my case the bean is the actual JPA hibernate class and so it's modeled as a String.

However, some extensions were written on top of Display Tag to provide filtering ie. searching whereby a textfield or popup is added as the header of each column. The idea is that it's suppose to populate an "example" object who's state is then used to perform the search. 

The example object is also an instance of the JPA hibernate class.

It just didn't seem like there was any way to override the actual declared type of the thing I'm searching by. There was no way to cover or annotate that I wanted to use an Enum to represent what I'm displaying to my user. Display value A but search using value B.

On Mar 16, 2013, at 4:26 AM, VANKEISBELCK Remi <[hidden email]> wrote:

Hi Robert, 

If the declared type is String the Stripes will bind to a String. If you wanna use an enum in the bean you can just do that.

What do you mean by "filter" ?

Cheers

Remi   

2013/3/16 VANKEISBELCK Remi <[hidden email]>
Hi Robert,

If the declared type is 


2013/3/16 Robert Nicholson <[hidden email]>
I'm still new to stripes but last week I had an issue where it wasn't using the correct type convertor on a binding.

So I  have a hibernate object that has an attribute represented as a varchar in the database and it's java type is a String

However I wanted to filter based on a type of Enum.

The code I saw seemed to go looking at the declared type of the attribute in order to figure out what kind of type converter should apply and so instead of end up with an Enum converter it arrives at a String converter.

How can you override this behavior?

My final solution was to do away with the Enum completely which means I had to display the value as "Y" "N" instead of "True" "False"



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users