Dan's Web Site

<<< back to the coding standard

package com.someproject.somepackage;


import com.someproject.util.StringUtils;


public class MyBlockDemo {

  private int myCounter = 0;
  private String myLabel = null;


  ///////////////////////////////////////////////////////////////////////
  // constructors
  ///////////////////////////////////////////////////////////////////////

  /**
    * Create a brand new instance of this object.
    */
  public MyBlockDemo () {
    this.init();
  }


  /**
   * @param inLable the new label for this instance
   *
   * @throws IllegalArgumentException if the label string is null, empty or
   *     entirely composed of whitespace characters
   */
  public MyBlockDemo ( String inLabel ) throws IllegalArgumentException {
    if ( StringUtils.isEmpty ( inLabel ) {
      throw new IllegalArgumentException("MyBlockDemo.constructor: The new "
        +"label supplied as input was either null or contained no data.");
    }

    this.myLabel = inLabel.trim();

    this.init();

  }//end constructor

    
  ///////////////////////////////////////////////////////////////////////
  // public methods
  ///////////////////////////////////////////////////////////////////////

  /**
    * @param inStartCount a new value for the counter
    *
    * @throws IllegalArgumentException if the new counter value is less than zero
    */
  public void setCounter ( int inVal ) throws IllegalArgumentException {
    if ( 0 > inVal ) {
      throw new IllegalArgumentException("MyBlockDemo.setCounter: The new counter "
        +" value '" + inVal + "' supplied as input was less than zero.");
    }

    this.myCounter = inVal;
  }




  ///////////////////////////////////////////////////////////////////////
  // private methods methods
  ///////////////////////////////////////////////////////////////////////

  /**
    * Perform instance initialization and setup.
    */
  private void init () {
    ... some initialization code ...
  }
 



}//end class







<<< back to the coding standard


Copyright © Dan Hay
Last update: Tuesday, 27-Sep-2005 15:25:33 UTC