File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes help creating java Object (data type) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "help creating java Object (data type)" Watch "help creating java Object (data type)" New topic

help creating java Object (data type)

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 484

I am creating an Object to hold a String projectName; and two other variables:

The first is a list of devices, which right now is just a List that belong to each projectName. I also need a List of channels that belong to each device. However I don't think it will work for me to just make this a List as well, because when I perform operations to populate the variables, the channels List will only be populated with the last set of channels it finds (or maybe all the channels for all devices).

If I have a project that has this layout:


--channel 1-1
--channel 1-2

-device 2
--channel 2-1

-device 3
--channel 3-1
--channel 3-2

It is not a problem to set the String projectName to the one project value, and I can put all the devices in one List without a problem. However the only way I would know to work the channels out in order to show ownership with a device is to create 3 channel List variables, one List to hold each of the channels for each device. And since there may be more or less devices and channels for each project this is a problem.

The end goal is to use this on a rich:tree, but I want to first see what my options are for data types. I really have no idea what would work for this

True wisdom is in knowing you know nothing - Socrates
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32811

How about a list of ChannelSet objects? The ChannelSet could contain the device id and a list of channels for it.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 484

Can you give me a bit more detail, Im not exactly sure how to implement what you mean
I agree. Here's the link:
subject: help creating java Object (data type)
It's not a secret anymore!