Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Class problem

Thread view: 
Shahid - 04 May 2006 15:16 GMT
Hello

I have a private class within a file.

When I try to do something like this:

ReportColumn column = (ReportColumn)r.get(i)

I get a message sayiing the type ReportColumn is not visible.

the variable r is an array which contains objects of ReportColumns and
that is working fine and done prior to this call.

Any help would be greatly appreciated

Shahid
Bjorn Abelli - 04 May 2006 15:34 GMT
> I have a private class within a file.

When you say "file", do you mean source code or .class-file?

And what do you mean with "private"? That it's a private inner class to
another?

> When I try to do something like this:
>
> ReportColumn column = (ReportColumn)r.get(i)
>
> I get a message sayiing the type ReportColumn is not visible.

Which is a correct behavior if you try to reach the class from "outside".

> the variable r is an array which contains objects of ReportColumns
> and that is working fine and done prior to this call.

How was the array instantiated and populated?

If you can reach the array, the elements should probably be reachable in a
similar manner.

I guess there is a reason to why the ReportColumn is "private". Could it be
that it implements a public interface, which you should use instead?

> Any help would be greatly appreciated

So what do you need help with?

You have provided a tad too little information on the circumstances of the
actual problem you're having.

// Bjorn A
Tony Morris - 05 May 2006 00:07 GMT
> Hello
>
[quoted text clipped - 12 lines]
>
> Shahid

If it is private, it is likely exposed via an interface.
This is a practice htat at least I have been using for a while. It forces
clients to use the contract reference type instead of the concrete type.
e.g.
ConcreteType ct = anything; // fails compilation - with the exception of the
dynamically typed null

Take a look at ContractualJ for an example of an API from which none of its
concrete types (read:classes), can have a reference declared and assigned.

Signature

Tony Morris
http://tmorris.net/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.