Note that there are some explanatory texts on larger screens.

plurals
  1. POConstant Parameter Design
    text
    copied!<p>I am working with a Class that contains constants or parameter values that all classes can reference for example;</p> <pre><code> public class Parameters { public static final String JUMP_TO_VALUE = "Parameters.JUMP_TO_VALUE"; public static final String EXCEPTION_ID = "Parameters.EXCEPTION_ID"; } </code></pre> <p>Some of the foundation classes in my application will use the parameter values in the Parameters class like so:</p> <pre><code> mapOfValues.put( Parameters.JUMP_TO_VALUE, "some_value") </code></pre> <p>This is simple enough I have some basic values in Parameters that most of my base classes will use them. There will be many situations where I will need to add addition parameters to the <b>Parameters</b> class, but I don't want to over populate or pollute the <b>Parameters</b> class ever time a new parameter is identified. I would rather create some subclass of <b>Parameters</b> like:</p> <pre><code> public class NetworkParameters extends Parameters { public static final String HOST_NAME = "NetworkParameters.HOST_NAME"; public static final String POST_NUM = "NetworkParameters.PORT_NUM"; } </code></pre> <p>Some of my specific classes will use the values that are contained in this class versus putting them in the <b>Parameters</b> class.</p> <p>These specific classes that need HOST_NAME for example I don't want them to reference the <b> NetworkParameters</b> class but rather the <b>Parameters</b> class. </p> <p>I am sure people have done this before but I am looking for advice on how best to implement this design.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload