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 / December 2005

Tip: Looking for answers? Try searching our database.

The best way to return a record layout?

Thread view: 
dmckeon@ameritas.com - 27 Dec 2005 15:23 GMT
I am in the process of converting a COBOL system to Java using web
services, but I am realy new to Java.  We currently use COBOL copybooks
that contain record layouts so we don't need to redefine database
fields and things like that.  I'm not seeing anything similar in Java.
In C++, we used structures, but they don't seem to exist in Java.  I
attempted to set up a class for the record layout that simply contained
methods to set field values and get field values.  I figured I could
use the class to populate the fields, return the class to the calling
method, and use the "get" functions to retrieve the data.  However,
when I attempt to use the methods within the class, they are not
available to me.  I assume they are protected somehow, which is
probably a good thing.

My question is, does anyone have any ideas of how I can accomplish what
I am trying to do?  I considered returning a delimited string of all of
the fields, but if we later add fields to the layout, we would have to
change EVERY program that tokenized the delimited string.  Clearly not
a good thing.

Any ideas would be very much appreciated.

Thanks,
Dan
Jeffrey Schwab - 27 Dec 2005 16:01 GMT
> I am in the process of converting a COBOL system to Java using web
> services, but I am realy new to Java.  We currently use COBOL copybooks
[quoted text clipped - 8 lines]
> available to me.  I assume they are protected somehow, which is
> probably a good thing.

Are the accessor methods ([gs]et*) declared "public?"  It would be
helpful if you could post the definition of one of your custom classes here.
dmckeon@ameritas.com - 28 Dec 2005 13:45 GMT
Everything is declared public.  Here is the class I have been testing
with.  I have it defined as a Dynamic Web Project and I am trying to
use the methods in a different Dynamic Web Project.  Could that be the
problem?  Practically speaking, I can't have every project that uses
this class be defined under the same Dynamic Web Project.  Maybe I'm
just missing the obvious since I'm new to this.  Thanks for the help!

public class ImageRecord {
    String appId;
    String imgPath;

    //constructor
    public ImageRecord() {
        init();
    }

    public void init(){
        this.appId = "";
        this.imgPath = "";
    }

    public void setappId(String appid) {
        this.appId = appid;
    }

    public void setimgPath(String path) {
        this.imgPath = path;
    }

    public String getappId() {
        return this.appId;
    }
       
    public String getimgPath() {
        return this.imgPath;
    }
}


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



©2008 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.