You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by CarloV <ca...@scs-computers.com> on 2008/07/08 15:08:22 UTC

inner class

I tried to use an inner class in a resultMap.

If i use the full name like it.scscomputers.storpa.model.Prova.AzioneEsito
i've got a ClassNotFoundExcemption.

Then as reported here
http://www.mail-archive.com/user-java@ibatis.apache.org/msg02492.html
i used the '$' instead of '.'.

But i've got another exception: JavaBeansDataExchange could not instantiate
result class.

What's going wrong?

Making AzioneEsito (the inner class) a normal class iBATIS work well.

Thanks for your attention 
Carlo 
-- 
View this message in context: http://www.nabble.com/inner-class-tp18338841p18338841.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: inner class

Posted by CarloV <ca...@scs-computers.com>.
Thanks,
as a java programmer i should had know this but sometimes this fundamentals
are forgotten..

Usig static nested classes and the '$' intead of '.' iBATIS work.

With inner classes iBATIS don't work but this is not a problem because inner
classes should be hidden to the outside world.


Gwyn wrote:
> 
> If it's a non-static inner class, then it can only be instantiated via a
> member of the containing class - See
> http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html, for
> instance - Nothing to do with where the source is...
> 
> /Gwyn
> 
> On Tue, Jul 8, 2008 at 3:48 PM, CarloV
> <ca...@scs-computers.com>
> wrote:
> 
>>
>> Yes, they are italian names.
>>
>> Thanks, i will try, even if this could be a serious problem in cases
>> where
>> i've no control about the source classes..
>>
>> This problem could be related to the fact tha the source code is in
>> WEB-INF/src while .class files are in WEB-INF/classes (it's a tomcat
>> project)?
>> The Exception raised is strange.....it seams it fiends the class but it's
>> not able to instantiate it.
>>
>>
>> Larry Meadors wrote:
>> >
>> > Cool, glad you liked the book. :)
>> >
>> > Try making it static - I think that will work if you refer to the
>> > class as OuterName$InnerName.
>> >
>> > Larry
>> >
>> >
>> > PS: Are those Italian names?
>> >
>> >
>> > On Tue, Jul 8, 2008 at 8:29 AM, CarloV
>> > <ca...@scs-computers.com> wrote:
>> >>
>> >> Hi Larry
>> >> i've read your book "iBATIS in action", great book for a great tool!
>> >>
>> >> No. This is the inner class's source code that i've extracted from
>> Prova
>> >> and
>> >> put on its own java file.
>> >>
>> >> public class FlagNormalita {
>> >>
>> >>        // Flag di normalità da controllare
>> >>        private String flag = null;
>> >>
>> >>        // Operazione da eseguire per questo flag
>> >>        private OpFlag flagOp = OpFlag.NESSUNA;
>> >>
>> >>        // Codice esito codificato da utilizzare (la tabella è quella
>> >> abbinata alla
>> >> prova).
>> >>        private String codEsito = null;
>> >>
>> >>        /**
>> >>         * @return Flag di normalità da controllare
>> >>         */
>> >>        public String getFlag() {
>> >>                if (flag == null) {
>> >>                        flag = new String();
>> >>                }
>> >>                return flag;
>> >>        }
>> >>
>> >>        /**
>> >>         * @param flag Flag di normalità da controllare
>> >>         */
>> >>        public void setFlag(String flag) {
>> >>                this.flag = flag;
>> >>        }
>> >>
>> >>        /**
>> >>         * @return Operazione da eseguire per questo flag
>> >>         */
>> >>        public OpFlag getFlagOp() {
>> >>                return flagOp;
>> >>        }
>> >>
>> >>        /**
>> >>         * @param flagOp Operazione da eseguire per questo flag
>> >>         */
>> >>        public void setFlagOp(OpFlag flagOp) {
>> >>                this.flagOp = flagOp;
>> >>        }
>> >>
>> >>        /**
>> >>         * @return Codice esito codificato da utilizzare (la tabella è
>> >> quella
>> >> abbinata alla prova).
>> >>         */
>> >>        public String getCodEsito() {
>> >>                if (codEsito == null) {
>> >>                        codEsito = new String();
>> >>                }
>> >>                return codEsito;
>> >>        }
>> >>
>> >>        /**
>> >>         * @param codEsito Codice esito codificato da utilizzare (la
>> >> tabella è
>> >> quella abbinata alla prova).
>> >>         */
>> >>        public void setCodEsito(String codEsito) {
>> >>                this.codEsito = codEsito;
>> >>        }
>> >> }
>> >>
>> >> Larry Meadors wrote:
>> >>>
>> >>> Is the inner class static?
>> >>>
>> >>> Larry
>> >>>
>> >>>
>> >>> On Tue, Jul 8, 2008 at 7:08 AM, CarloV
>> >>> <ca...@scs-computers.com> wrote:
>> >>>>
>> >>>> I tried to use an inner class in a resultMap.
>> >>>>
>> >>>> If i use the full name like
>> >>>> it.scscomputers.storpa.model.Prova.AzioneEsito
>> >>>> i've got a ClassNotFoundExcemption.
>> >>>>
>> >>>> Then as reported here
>> >>>>
>> http://www.mail-archive.com/user-java@ibatis.apache.org/msg02492.html
>> >>>> i used the '$' instead of '.'.
>> >>>>
>> >>>> But i've got another exception: JavaBeansDataExchange could not
>> >>>> instantiate
>> >>>> result class.
>> >>>>
>> >>>> What's going wrong?
>> >>>>
>> >>>> Making AzioneEsito (the inner class) a normal class iBATIS work
>> well.
>> >>>>
>> >>>> Thanks for your attention
>> >>>> Carlo
>> >>>> --
>> >>>> View this message in context:
>> >>>> http://www.nabble.com/inner-class-tp18338841p18338841.html
>> >>>> Sent from the iBATIS - User - Java mailing list archive at
>> Nabble.com.
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/inner-class-tp18338841p18340556.html
>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/inner-class-tp18338841p18340906.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/inner-class-tp18338841p18357755.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: inner class

Posted by Gwyn Evans <gw...@gmail.com>.
If it's a non-static inner class, then it can only be instantiated via a
member of the containing class - See
http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html, for
instance - Nothing to do with where the source is...

/Gwyn

On Tue, Jul 8, 2008 at 3:48 PM, CarloV <ca...@scs-computers.com>
wrote:

>
> Yes, they are italian names.
>
> Thanks, i will try, even if this could be a serious problem in cases where
> i've no control about the source classes..
>
> This problem could be related to the fact tha the source code is in
> WEB-INF/src while .class files are in WEB-INF/classes (it's a tomcat
> project)?
> The Exception raised is strange.....it seams it fiends the class but it's
> not able to instantiate it.
>
>
> Larry Meadors wrote:
> >
> > Cool, glad you liked the book. :)
> >
> > Try making it static - I think that will work if you refer to the
> > class as OuterName$InnerName.
> >
> > Larry
> >
> >
> > PS: Are those Italian names?
> >
> >
> > On Tue, Jul 8, 2008 at 8:29 AM, CarloV
> > <ca...@scs-computers.com> wrote:
> >>
> >> Hi Larry
> >> i've read your book "iBATIS in action", great book for a great tool!
> >>
> >> No. This is the inner class's source code that i've extracted from Prova
> >> and
> >> put on its own java file.
> >>
> >> public class FlagNormalita {
> >>
> >>        // Flag di normalità da controllare
> >>        private String flag = null;
> >>
> >>        // Operazione da eseguire per questo flag
> >>        private OpFlag flagOp = OpFlag.NESSUNA;
> >>
> >>        // Codice esito codificato da utilizzare (la tabella è quella
> >> abbinata alla
> >> prova).
> >>        private String codEsito = null;
> >>
> >>        /**
> >>         * @return Flag di normalità da controllare
> >>         */
> >>        public String getFlag() {
> >>                if (flag == null) {
> >>                        flag = new String();
> >>                }
> >>                return flag;
> >>        }
> >>
> >>        /**
> >>         * @param flag Flag di normalità da controllare
> >>         */
> >>        public void setFlag(String flag) {
> >>                this.flag = flag;
> >>        }
> >>
> >>        /**
> >>         * @return Operazione da eseguire per questo flag
> >>         */
> >>        public OpFlag getFlagOp() {
> >>                return flagOp;
> >>        }
> >>
> >>        /**
> >>         * @param flagOp Operazione da eseguire per questo flag
> >>         */
> >>        public void setFlagOp(OpFlag flagOp) {
> >>                this.flagOp = flagOp;
> >>        }
> >>
> >>        /**
> >>         * @return Codice esito codificato da utilizzare (la tabella è
> >> quella
> >> abbinata alla prova).
> >>         */
> >>        public String getCodEsito() {
> >>                if (codEsito == null) {
> >>                        codEsito = new String();
> >>                }
> >>                return codEsito;
> >>        }
> >>
> >>        /**
> >>         * @param codEsito Codice esito codificato da utilizzare (la
> >> tabella è
> >> quella abbinata alla prova).
> >>         */
> >>        public void setCodEsito(String codEsito) {
> >>                this.codEsito = codEsito;
> >>        }
> >> }
> >>
> >> Larry Meadors wrote:
> >>>
> >>> Is the inner class static?
> >>>
> >>> Larry
> >>>
> >>>
> >>> On Tue, Jul 8, 2008 at 7:08 AM, CarloV
> >>> <ca...@scs-computers.com> wrote:
> >>>>
> >>>> I tried to use an inner class in a resultMap.
> >>>>
> >>>> If i use the full name like
> >>>> it.scscomputers.storpa.model.Prova.AzioneEsito
> >>>> i've got a ClassNotFoundExcemption.
> >>>>
> >>>> Then as reported here
> >>>> http://www.mail-archive.com/user-java@ibatis.apache.org/msg02492.html
> >>>> i used the '$' instead of '.'.
> >>>>
> >>>> But i've got another exception: JavaBeansDataExchange could not
> >>>> instantiate
> >>>> result class.
> >>>>
> >>>> What's going wrong?
> >>>>
> >>>> Making AzioneEsito (the inner class) a normal class iBATIS work well.
> >>>>
> >>>> Thanks for your attention
> >>>> Carlo
> >>>> --
> >>>> View this message in context:
> >>>> http://www.nabble.com/inner-class-tp18338841p18338841.html
> >>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>>>
> >>>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/inner-class-tp18338841p18340556.html
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/inner-class-tp18338841p18340906.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Re: inner class

Posted by CarloV <ca...@scs-computers.com>.
Yes, they are italian names.

Thanks, i will try, even if this could be a serious problem in cases where
i've no control about the source classes..

This problem could be related to the fact tha the source code is in
WEB-INF/src while .class files are in WEB-INF/classes (it's a tomcat
project)?
The Exception raised is strange.....it seams it fiends the class but it's
not able to instantiate it.


Larry Meadors wrote:
> 
> Cool, glad you liked the book. :)
> 
> Try making it static - I think that will work if you refer to the
> class as OuterName$InnerName.
> 
> Larry
> 
> 
> PS: Are those Italian names?
> 
> 
> On Tue, Jul 8, 2008 at 8:29 AM, CarloV
> <ca...@scs-computers.com> wrote:
>>
>> Hi Larry
>> i've read your book "iBATIS in action", great book for a great tool!
>>
>> No. This is the inner class's source code that i've extracted from Prova
>> and
>> put on its own java file.
>>
>> public class FlagNormalita {
>>
>>        // Flag di normalità da controllare
>>        private String flag = null;
>>
>>        // Operazione da eseguire per questo flag
>>        private OpFlag flagOp = OpFlag.NESSUNA;
>>
>>        // Codice esito codificato da utilizzare (la tabella è quella
>> abbinata alla
>> prova).
>>        private String codEsito = null;
>>
>>        /**
>>         * @return Flag di normalità da controllare
>>         */
>>        public String getFlag() {
>>                if (flag == null) {
>>                        flag = new String();
>>                }
>>                return flag;
>>        }
>>
>>        /**
>>         * @param flag Flag di normalità da controllare
>>         */
>>        public void setFlag(String flag) {
>>                this.flag = flag;
>>        }
>>
>>        /**
>>         * @return Operazione da eseguire per questo flag
>>         */
>>        public OpFlag getFlagOp() {
>>                return flagOp;
>>        }
>>
>>        /**
>>         * @param flagOp Operazione da eseguire per questo flag
>>         */
>>        public void setFlagOp(OpFlag flagOp) {
>>                this.flagOp = flagOp;
>>        }
>>
>>        /**
>>         * @return Codice esito codificato da utilizzare (la tabella è
>> quella
>> abbinata alla prova).
>>         */
>>        public String getCodEsito() {
>>                if (codEsito == null) {
>>                        codEsito = new String();
>>                }
>>                return codEsito;
>>        }
>>
>>        /**
>>         * @param codEsito Codice esito codificato da utilizzare (la
>> tabella è
>> quella abbinata alla prova).
>>         */
>>        public void setCodEsito(String codEsito) {
>>                this.codEsito = codEsito;
>>        }
>> }
>>
>> Larry Meadors wrote:
>>>
>>> Is the inner class static?
>>>
>>> Larry
>>>
>>>
>>> On Tue, Jul 8, 2008 at 7:08 AM, CarloV
>>> <ca...@scs-computers.com> wrote:
>>>>
>>>> I tried to use an inner class in a resultMap.
>>>>
>>>> If i use the full name like
>>>> it.scscomputers.storpa.model.Prova.AzioneEsito
>>>> i've got a ClassNotFoundExcemption.
>>>>
>>>> Then as reported here
>>>> http://www.mail-archive.com/user-java@ibatis.apache.org/msg02492.html
>>>> i used the '$' instead of '.'.
>>>>
>>>> But i've got another exception: JavaBeansDataExchange could not
>>>> instantiate
>>>> result class.
>>>>
>>>> What's going wrong?
>>>>
>>>> Making AzioneEsito (the inner class) a normal class iBATIS work well.
>>>>
>>>> Thanks for your attention
>>>> Carlo
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/inner-class-tp18338841p18338841.html
>>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/inner-class-tp18338841p18340556.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/inner-class-tp18338841p18340906.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: inner class

Posted by Larry Meadors <la...@gmail.com>.
Cool, glad you liked the book. :)

Try making it static - I think that will work if you refer to the
class as OuterName$InnerName.

Larry


PS: Are those Italian names?


On Tue, Jul 8, 2008 at 8:29 AM, CarloV
<ca...@scs-computers.com> wrote:
>
> Hi Larry
> i've read your book "iBATIS in action", great book for a great tool!
>
> No. This is the inner class's source code that i've extracted from Prova and
> put on its own java file.
>
> public class FlagNormalita {
>
>        // Flag di normalità da controllare
>        private String flag = null;
>
>        // Operazione da eseguire per questo flag
>        private OpFlag flagOp = OpFlag.NESSUNA;
>
>        // Codice esito codificato da utilizzare (la tabella è quella abbinata alla
> prova).
>        private String codEsito = null;
>
>        /**
>         * @return Flag di normalità da controllare
>         */
>        public String getFlag() {
>                if (flag == null) {
>                        flag = new String();
>                }
>                return flag;
>        }
>
>        /**
>         * @param flag Flag di normalità da controllare
>         */
>        public void setFlag(String flag) {
>                this.flag = flag;
>        }
>
>        /**
>         * @return Operazione da eseguire per questo flag
>         */
>        public OpFlag getFlagOp() {
>                return flagOp;
>        }
>
>        /**
>         * @param flagOp Operazione da eseguire per questo flag
>         */
>        public void setFlagOp(OpFlag flagOp) {
>                this.flagOp = flagOp;
>        }
>
>        /**
>         * @return Codice esito codificato da utilizzare (la tabella è quella
> abbinata alla prova).
>         */
>        public String getCodEsito() {
>                if (codEsito == null) {
>                        codEsito = new String();
>                }
>                return codEsito;
>        }
>
>        /**
>         * @param codEsito Codice esito codificato da utilizzare (la tabella è
> quella abbinata alla prova).
>         */
>        public void setCodEsito(String codEsito) {
>                this.codEsito = codEsito;
>        }
> }
>
> Larry Meadors wrote:
>>
>> Is the inner class static?
>>
>> Larry
>>
>>
>> On Tue, Jul 8, 2008 at 7:08 AM, CarloV
>> <ca...@scs-computers.com> wrote:
>>>
>>> I tried to use an inner class in a resultMap.
>>>
>>> If i use the full name like
>>> it.scscomputers.storpa.model.Prova.AzioneEsito
>>> i've got a ClassNotFoundExcemption.
>>>
>>> Then as reported here
>>> http://www.mail-archive.com/user-java@ibatis.apache.org/msg02492.html
>>> i used the '$' instead of '.'.
>>>
>>> But i've got another exception: JavaBeansDataExchange could not
>>> instantiate
>>> result class.
>>>
>>> What's going wrong?
>>>
>>> Making AzioneEsito (the inner class) a normal class iBATIS work well.
>>>
>>> Thanks for your attention
>>> Carlo
>>> --
>>> View this message in context:
>>> http://www.nabble.com/inner-class-tp18338841p18338841.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/inner-class-tp18338841p18340556.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Re: inner class

Posted by CarloV <ca...@scs-computers.com>.
Hi Larry
i've read your book "iBATIS in action", great book for a great tool!

No. This is the inner class's source code that i've extracted from Prova and
put on its own java file.

public class FlagNormalita {

	// Flag di normalità da controllare
	private String flag = null;

	// Operazione da eseguire per questo flag
	private OpFlag flagOp = OpFlag.NESSUNA;

	// Codice esito codificato da utilizzare (la tabella è quella abbinata alla
prova).
	private String codEsito = null;

	/**
	 * @return Flag di normalità da controllare
	 */
	public String getFlag() {
		if (flag == null) {
			flag = new String();
		}
		return flag;
	}

	/**
	 * @param flag Flag di normalità da controllare
	 */
	public void setFlag(String flag) {
		this.flag = flag;
	}

	/**
	 * @return Operazione da eseguire per questo flag
	 */
	public OpFlag getFlagOp() {
		return flagOp;
	}

	/**
	 * @param flagOp Operazione da eseguire per questo flag
	 */
	public void setFlagOp(OpFlag flagOp) {
		this.flagOp = flagOp;
	}

	/**
	 * @return Codice esito codificato da utilizzare (la tabella è quella
abbinata alla prova).
	 */
	public String getCodEsito() {
		if (codEsito == null) {
			codEsito = new String();
		}
		return codEsito;
	}

	/**
	 * @param codEsito Codice esito codificato da utilizzare (la tabella è
quella abbinata alla prova).
	 */
	public void setCodEsito(String codEsito) {
		this.codEsito = codEsito;
	}
}

Larry Meadors wrote:
> 
> Is the inner class static?
> 
> Larry
> 
> 
> On Tue, Jul 8, 2008 at 7:08 AM, CarloV
> <ca...@scs-computers.com> wrote:
>>
>> I tried to use an inner class in a resultMap.
>>
>> If i use the full name like
>> it.scscomputers.storpa.model.Prova.AzioneEsito
>> i've got a ClassNotFoundExcemption.
>>
>> Then as reported here
>> http://www.mail-archive.com/user-java@ibatis.apache.org/msg02492.html
>> i used the '$' instead of '.'.
>>
>> But i've got another exception: JavaBeansDataExchange could not
>> instantiate
>> result class.
>>
>> What's going wrong?
>>
>> Making AzioneEsito (the inner class) a normal class iBATIS work well.
>>
>> Thanks for your attention
>> Carlo
>> --
>> View this message in context:
>> http://www.nabble.com/inner-class-tp18338841p18338841.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/inner-class-tp18338841p18340556.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: inner class

Posted by Larry Meadors <la...@gmail.com>.
Is the inner class static?

Larry


On Tue, Jul 8, 2008 at 7:08 AM, CarloV
<ca...@scs-computers.com> wrote:
>
> I tried to use an inner class in a resultMap.
>
> If i use the full name like it.scscomputers.storpa.model.Prova.AzioneEsito
> i've got a ClassNotFoundExcemption.
>
> Then as reported here
> http://www.mail-archive.com/user-java@ibatis.apache.org/msg02492.html
> i used the '$' instead of '.'.
>
> But i've got another exception: JavaBeansDataExchange could not instantiate
> result class.
>
> What's going wrong?
>
> Making AzioneEsito (the inner class) a normal class iBATIS work well.
>
> Thanks for your attention
> Carlo
> --
> View this message in context: http://www.nabble.com/inner-class-tp18338841p18338841.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>