Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:23:44+00:00 2026-06-09T07:23:44+00:00

I am using Dozer to do object Mapping. Everything works reaaly well just that

  • 0

I am using Dozer to do object Mapping. Everything works reaaly well just that I’m not able to map this particular thing.

<mapping>
<class-a>User</class-a>
<class-b>UAUserBean</class-b>
<field>
<a>RightLst.Right</a>
<b>Rights</b>
<a-hint>Right</a-hint>
<b-hint>UARightBean</b-hint>
</field>
<field>
<a>RightLst.NumInLst</a> 
<b>Rights.length</b> 
</field>
</mapping>

//here RightLst is an object of a class and numInLst (int prop)
//rights is an array of objects

what i want to do is

lUser.getRightLst().setNumInLst(uaUserBean.getRights().length);

Any suggestions??

Thanks in advance.


User{ 
protected RightLst rightLst;
}

RightLst{
protected Integer numInLst;
protected Collection right = new ArrayList();
}

public class UAUserBean{
private UARightBean[] rights;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:23:45+00:00Added an answer on June 9, 2026 at 7:23 am

    When you do this:

    ...
       <b>rights.length</b> 
    </field>
    

    Dozer will try to access the first position of the rights array and call the getter for the length property on an instance of UARightBean (which is the type of the array), obviously the length property doesn’t exist in UARightBean and Dozer will throw an Exception.

    I suggest to create a getter method in UAUserBean to return the length of the rights property, it would look like this:

     class UAUserBean {
            ... 
            public int getRightsLength() {
                return rights != null ? rights.length : 0;
            }       
        }
    

    Mapping file:

    <class-a>User</class-a>
    <class-b>UAUserBean</class-b>
    <field>
        <a>rightLst.numInLst</a> 
        <b>rightsLength</b> 
    </field>
    

    If you can’t modify UAUserBean, your last option would be a custom converter from UARightBean[] to Integer, but it would look ugly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Dozer to map two objects, I have: /** /* This first class uses
I want to exclude a field using Dozer like this : <mapping> <class-a>com.core.model.Model</class-a> <class-b>com.core.model.ModelIS</class-b>
I am using Dozer mapper to map Service objects to Value objects. I am
I am currently using Dozer to map to sets of objects. I have a
I'm using Dozer to map Hibernate entities to their DTOs. A simplified example class
I need to map class A into class C using dozer framework. public class
I am trying to use Dozer Java API to map two java classes using
I have two questions related to the performance of Dozer using its Java API:
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
I am in the middle of development of a WPF application that is using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.