Properties file(s)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Properties file(s)

  1. #1
    John Warkentin Guest

    Properties file(s)

    I am writing a simulation that will use a set of variables which I plan to
    store externally from the code. Default values for the variables will be
    stored in a properties file (File 1). For example:

    File 1:
    X=3
    Y=7
    Z=2

    File 2:
    Y=5

    After opening and reading File 1, how could I open a SECOND properties file
    (File 2) and read values to override the values read from File 1? I want
    the end result to be:

    X=3
    Y=5
    Z=2




  2. #2
    Kent Guest

    Re: Properties file(s)


    John,

    Just use the load() method of the Properties class. Load twice - one for
    each file.

    Kent


    "John Warkentin" <john.warkentin@pmic.com> wrote:
    >I am writing a simulation that will use a set of variables which I plan

    to
    >store externally from the code. Default values for the variables will be
    >stored in a properties file (File 1). For example:
    >
    >File 1:
    >X=3
    >Y=7
    >Z=2
    >
    >File 2:
    >Y=5
    >
    >After opening and reading File 1, how could I open a SECOND properties file
    >(File 2) and read values to override the values read from File 1? I want
    >the end result to be:
    >
    >X=3
    >Y=5
    >Z=2
    >
    >
    >



  3. #3
    MarkN Guest

    Re: Properties file(s)


    John,
    In addition to what Kent said, you will want to separate the persistance
    from the domain object. So while your data is store in properties files,
    you should hide that. To do this, determine what x,y,z are or are part of.
    A guess, from the info you provided, is that it is Point object.

    Mark


    "Kent" <kb@essential.com.au> wrote:
    >
    >John,
    >
    >Just use the load() method of the Properties class. Load twice - one for
    >each file.
    >
    >Kent
    >
    >
    >"John Warkentin" <john.warkentin@pmic.com> wrote:
    >>I am writing a simulation that will use a set of variables which I plan

    >to
    >>store externally from the code. Default values for the variables will

    be
    >>stored in a properties file (File 1). For example:
    >>
    >>File 1:
    >>X=3
    >>Y=7
    >>Z=2
    >>
    >>File 2:
    >>Y=5
    >>
    >>After opening and reading File 1, how could I open a SECOND properties

    file
    >>(File 2) and read values to override the values read from File 1? I want
    >>the end result to be:
    >>
    >>X=3
    >>Y=5
    >>Z=2
    >>
    >>
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center