I suspected that that making the inner class private would break things, but
wanted confirm.  I attempted referencing the inner class as follows (also
used many different variations as I wasn't sure where I should be
referencing as 'Student.Course'), but still got an exception saying the
inner class couldn't be found.  I also tried using '$'....no go.

        ...
         <field name="CourseList" type="collection" type="Student.Course">
             <bind-xml name="Course"/>
         </field>
     </class>

     <class name="Student.Course">
    ....

----- Original Message -----
From: "Oliver Hutchison" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 18, 2001 3:10 PM
Subject: Re: [castor-dev] Mapping Inner Classes


> You should be using "Student.Course" for the name attribute. And it wont
> work if it's private anyway.
>
> Oliver
>
> -----Original Message-----
> From: John M. Corro [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 19 December 2001 11:58 AM
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] Mapping Inner Classes
>
>
> I've searched around on the Castor mail archive regarding mapping inner
> classes and the only resolution I could find was from someone who
> altered
> the source code to accept '$' signs (don't recall the exact steps) as
> delimiters identifying inner classes.  I was hoping that there was
> someone
> who could shed some light on an alternate way to map inner classes w/o
> changing the source code.
>
> If inner classes can be used w/o altering source code, do the inner
> classes
> need to be public?  When I try running code along the same lines as the
> following example, I always get a MappingException saying the compiler
> can't
> find the inner class.  Following is an example of what I'm trying to
> do...
> Thanks in advance for any help.
>
>
> public class Student
> {
>     private class Course
>     {
>         public String courseID
>         public String courseName
>     }
>
>     private String name = "John Doe";
>     private ArrayList courseList = new ArrayList();
>
>     public Student()
>     {
>             Course course = new Course();
>             course.courseID = "1";
>             course.courseName = "Gym";
>             courseList.add(course);
>
>             course = new Course();
>             course.courseID = "2";
>             course.courseName = "Chemistry";
>     }
>
>     public String getName....
>     public ArrayList getCourseList...
> }
>
> <mapping>
>     <class name="Student">
>         <map-to xml="root"/>
>         <field name="Name" type="java.lang.String">
>             <bind-xml name="Name" node="element"/>
>         </field>
>         <field name="CourseList" type="collection">
>             <bind-xml name="Course"/>
>         </field>
>     </class>
>
>     <class name="Course">
>         <field name="CourseID" type="java.lang.String">
>             <bind-xml name="CourseID" node="element"/>
>         </field>
>         <field name="CourseName" type="java.lang.String">
>             <bind-xml name="CourseName" node="element"/>
>         </field>
>     </class>
> </map>
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
>
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to