Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dozer partially case sensitive in 5.5.1 #195

Closed
alangibson opened this issue Sep 17, 2014 · 10 comments
Closed

Dozer partially case sensitive in 5.5.1 #195

alangibson opened this issue Sep 17, 2014 · 10 comments
Milestone

Comments

@alangibson
Copy link

Field mappings are apparently now partially case sensitive in Dozer 5.5.1. There appears to be no option to switch back to the 5.4.0 case-insensitive mappings.

Example from discussion at https://groups.google.com/forum/#!topic/dozer-mapper/k6i_Bf6ZIMc.

import org.dozer.DozerBeanMapper;
public class App {
public static void main(String[] args) {
DozerBeanMapper mapper = new DozerBeanMapper();
UpperCaseBean src = new UpperCaseBean();
src.setMYSTRING("This is from the upper case bean");
LowerCaseBean dst = new LowerCaseBean();
mapper.map(src, dst);
System.out.println(dst.getmystring());
}
public static class UpperCaseBean {
private String MYSTRING;
public String getMYSTRING() {
return MYSTRING;
}
public void setMYSTRING(String MYSTRING) {
this.MYSTRING = MYSTRING;
}
}
public static class LowerCaseBean {
private String mystring;
public void setmystring(String mystring) {
this.mystring = mystring;
}
public String getmystring() {
return this.mystring;
}
}
}

With the following mapping, the "mystring" field will not be mapped:

UpperCaseBean LowerCaseBean

However, with the following mapping, the field "mystring" will be mapped:

UpperCaseBean LowerCaseBean mystring mystring

This seems like very counter-intuitive behavior. It would be nice to simply add a configuration option to control this behavior.

@buzdin buzdin modified the milestone: 5.5.2 Nov 25, 2014
@brian428
Copy link

This seems like kind of a HUGE problem, since it totally breaks automatic mapping for any properties with different cases in the getters or setters.

@madhurimav
Copy link

I am also facing the same problem with version 5.5.1 .please share the fix for this case sensitive issue.
Is there a configuration flag available to map the case sensitive fields?

@brian428
Copy link

brian428 commented Jul 6, 2015

Does anyone know if this has been fixed? The only workaround we've found is to manually list out every single property name in the mapping files, which is obviously a really undesirable option.

@obozek
Copy link

obozek commented Aug 10, 2015

+1

@RaphC
Copy link

RaphC commented Nov 27, 2015

I'm also facing the same issue

@brian428
Copy link

I getting the impression that Dozer development is stopped, unfortunately. I see there's only been 4 commits in the last year. :-( It might be fork time...

@garethahealy
Copy link
Collaborator

@brian428 ; I am trying to get Dozer active again. Happy for any pull requests / help.

@garethahealy
Copy link
Collaborator

Closing due to inactivity.

@grubeninspekteur
Copy link
Contributor

I'd like to maintain backwards compatibility by optionally supporting case insensitive mapping. I can think of two ways to implement this:

  • add a configuration flag "wildcard-case-insensitive" to global and per-mapping configurations.
  • use a wildcard mapping strategy interface that takes the lists of unmapped fields, src and dest classes and determines pairs of src/dest fields to map. The implementation could be configured at global or class-pair-mapping level. A case sensitive strategy would be provided as default and the case insensitive one as an alternative.

@garethahealy Which would you prefer? Also, I'm unsure what should happen if a class defines two parameters that are equal except for their case. This affects both the filter step for already mapped fields as well as the field alignment.

@garethahealy
Copy link
Collaborator

garethahealy commented Feb 13, 2018

@grubeninspekteur ; Configuration options sounds best.

garethahealy pushed a commit that referenced this issue Mar 20, 2018
* Added option to enable case insensitive wildcard mapping (#195)

* Restructured configuration documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants