🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15806

Re: Dynamic Object naming

#15806
From: Jason Burton
Date: Fri, 30 Apr 1999 00:00
26 lines
1505 bytes
> Problem : I have an everchanging list of data in CSV file formats. I
> want to read the data in a row at a time and create a new object each
> time with the name of the object being the the first record.
>
> Sample Data & Code:
> ABCD,12345,Object Description
>
> objectname name = new objectname("ABCD","12345","Object Description");

It seems logical that all of these objects that you might create need to be
ancestors of a common (possibly abstract) object.
the Class.forName(String className) method will at least load the class
using a string. Example:

try
{
    Object object = Class.forName("ABCD").newInstance();  // I don't think
there's a way to pass parameters using this method
    if (object instanceof MyCommonObject)
    {
        MyCommonObject commonObject = (MyCommonObject)object;
        commonObject.setFirstProperty("12345");
        commonObject.setDescription("Object Description");
    }

Jason
Technical Details
Message-ID: <7gceu1$qk69@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37223bb8.54523408@forums.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3bd2683886106cb3
X-Google-Attributes: gidf74b3,public
From: "Jason Burton" <Jason.Burton@McLeodSoftware.com>
Subject: Re: Dynamic Object naming
Date: 1999/04/30
Message-ID: <7gceu1$qk69@forums.borland.com>
X-Deja-AN: 472702479
References: <37223bb8.54523408@forums.inprise.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.language