T
toton
Hi,
I have a class Document, which represents the data repository (a
singleton class), from where the whole application gets the nessery
Objects they need. Which prevents me from passing the Data from method
to method.
Now I only want to give access some of the class to modify some of the
data.
Thus like, Document object can return CC object, or Segment object or
Header object.
Now only SegmentCalculator can create (may be modify sometimes,
otherwise they are immutable) a segment, the other can get Segment
object, which has no setters.
Similarly HeaderCalculator can create a header and store in the
Document. others can use it.
remaining organization and class relationships are flexible. Only my
concern is a good OO design for this (in Java) . I have thought a
package level modifier for setters in Document, but doesn't seems a
good solution, ans SegmentCalculator & Headercalculator may be in
different package.
Thus the basic idea is to operate on a set of data objects, where all
can use them, but only some can modify.
How to organize this kind of situation into class representation? Any
pattern exists for this? I have searched GOF book & Java Patterns, but
unable to locate a good solution for this kind of senario.
any kind of help is appriciated.
I have a class Document, which represents the data repository (a
singleton class), from where the whole application gets the nessery
Objects they need. Which prevents me from passing the Data from method
to method.
Now I only want to give access some of the class to modify some of the
data.
Thus like, Document object can return CC object, or Segment object or
Header object.
Now only SegmentCalculator can create (may be modify sometimes,
otherwise they are immutable) a segment, the other can get Segment
object, which has no setters.
Similarly HeaderCalculator can create a header and store in the
Document. others can use it.
remaining organization and class relationships are flexible. Only my
concern is a good OO design for this (in Java) . I have thought a
package level modifier for setters in Document, but doesn't seems a
good solution, ans SegmentCalculator & Headercalculator may be in
different package.
Thus the basic idea is to operate on a set of data objects, where all
can use them, but only some can modify.
How to organize this kind of situation into class representation? Any
pattern exists for this? I have searched GOF book & Java Patterns, but
unable to locate a good solution for this kind of senario.
any kind of help is appriciated.