• Visible Java Class Constants

    By John Marshall 2 decades ago

    Can you make severity type constants available outside the OpenLogItem Java class i.e. make them public.



    // common severity types

    static final String SEVERITY_LOW = "0";

    static final String SEVERITY_MEDIUM = "1";

    static final String SEVERITY_HIGH = "2";



    to



    // common severity types

    public static final String SEVERITY_LOW = "0";

    public static final String SEVERITY_MEDIUM = "1";

    public static final String SEVERITY_HIGH = "2";



    Then I dont need to remember there values as I find it difficult remembering three numbers especially when there sequential ;)



    I can then use these constants thus:



    public static OpenLogItem oli = new OpenLogItem();// Log Stuff

    <br/>
    

    public void doStuff() {

    oli.logEvent("My Event", OpenLogItem.SEVERITY_HIGH, doc);

    oli.logEvent("My Other Event", oli.SEVERITY_HIGH, doc);

    }





    Thanks.

    • Added to Release 1.0

      By Julian Robichaux 2 decades ago

      I added this to release 1.0 (and it should have been like this the whole time… sorry 'bout that). Thanks!