You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2005/01/17 11:28:38 UTC

cvs commit: jakarta-commons/digester/src/examples/xmlrules/addressbook Address.java

skitching    2005/01/17 02:28:38

  Modified:    digester/src/examples/xmlrules/addressbook Address.java
  Log:
  Add print method that lays out address info a little neater.
  Also converted tabs to spaces.
  
  Revision  Changes    Path
  1.2       +137 -118  jakarta-commons/digester/src/examples/xmlrules/addressbook/Address.java
  
  Index: Address.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/examples/xmlrules/addressbook/Address.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Address.java	17 Jan 2005 09:45:22 -0000	1.1
  +++ Address.java	17 Jan 2005 10:28:38 -0000	1.2
  @@ -21,124 +21,143 @@
    * See Main.java.
    */
   public class Address {
  -  private String type;
  -  private String street;
  -  private String city;
  -  private String state;
  -  private String zip;
  -  private String country;
  -  
  -
  -  public String toString() {
  -      StringBuffer sb = new StringBuffer();
  -      sb.append( " address (type "+ type + ")\n");
  -      sb.append( "       " + street + "\n");
  -      sb.append( "       " + city + " " + state + " " + zip + "\n");
  -      sb.append( "       " + country + "\n");
  -      return sb.toString();
  -  }
  -
  -	/**
  -	 * Returns the value of street.
  -	 */
  -	public String getStreet()
  -	{
  -		 return street; 
  -	}
  -
  -	/**
  -	 * Sets the value of street.
  -	 * @param street The value to assign to street.
  -	 */
  -	public void setStreet(String street)
  -	{
  -		 this.street = street; 
  -	}
  -
  -	/**
  -	 * Returns the value of city.
  -	 */
  -	public String getCity()
  -	{
  -		 return city; 
  -	}
  -
  -	/**
  -	 * Sets the value of city.
  -	 * @param city The value to assign to city.
  -	 */
  -	public void setCity(String city)
  -	{
  -		 this.city = city; 
  -	}
  -
  -	/**
  -	 * Returns the value of state.
  -	 */
  -	public String getState()
  -	{
  -		 return state; 
  -	}
  -
  -	/**
  -	 * Sets the value of state.
  -	 * @param state The value to assign to state.
  -	 */
  -	public void setState(String state)
  -	{
  -		 this.state = state; 
  -	}
  -
  -	/**
  -	 * Returns the value of zip.
  -	 */
  -	public String getZip()
  -	{
  -		 return zip; 
  -	}
  -
  -	/**
  -	 * Sets the value of zip.
  -	 * @param zip The value to assign to zip.
  -	 */
  -	public void setZip(String zip)
  -	{
  -		 this.zip = zip; 
  -	}
  -
  -	/**
  -	 * Returns the value of country.
  -	 */
  -	public String getCountry()
  -	{
  -		 return country; 
  -	}
  -
  -	/**
  -	 * Sets the value of country.
  -	 * @param country The value to assign to country.
  -	 */
  -	public void setCountry(String country)
  -	{
  -		 this.country = country; 
  -	}
  -
  -	/**
  -	 * Returns the value of type.
  -	 */
  -	public String getType()
  -	{
  -		 return type; 
  -	}
  -
  -	/**
  -	 * Sets the value of type.
  -	 * @param type The value to assign to type.
  -	 */
  -	public void setType(String type)
  -	{
  -		 this.type = type; 
  -	}
  +    private String type;
  +    private String street;
  +    private String city;
  +    private String state;
  +    private String zip;
  +    private String country;
  +
  +    public String toString() {
  +        StringBuffer sb = new StringBuffer();
  +        sb.append( " address (type "+ type + ")\n");
  +        sb.append( "       " + street + "\n");
  +        sb.append( "       " + city + " " + state + " " + zip + "\n");
  +        sb.append( "       " + country + "\n");
  +        return sb.toString();
  +    }
  +
  +    public void print(java.io.PrintStream out, int indentAmount) {
  +        StringBuffer indentStr = new StringBuffer(indentAmount);
  +        for(; indentAmount > 0; --indentAmount) {
  +            indentStr.append(' ');
  +        }
  +        
  +        out.print(indentStr);
  +        out.print("address type: ");
  +        out.println(type);
  +        
  +        out.print(indentStr);
  +        out.println("  " + street);
  +        
  +        out.print(indentStr);
  +        out.println("  " + city + " " + state + " " + zip);
  +        
  +        out.print(indentStr);
  +        out.println("  " + country);
  +    }
  +    
  +    /**
  +     * Returns the value of street.
  +     */
  +    public String getStreet()
  +    {
  +         return street; 
  +    }
  +
  +    /**
  +     * Sets the value of street.
  +     * @param street The value to assign to street.
  +     */
  +    public void setStreet(String street)
  +    {
  +        this.street = street; 
  +    }
  +
  +    /**
  +     * Returns the value of city.
  +     */
  +    public String getCity()
  +    {
  +        return city; 
  +    }
  +
  +    /**
  +     * Sets the value of city.
  +     * @param city The value to assign to city.
  +     */
  +    public void setCity(String city)
  +    {
  +        this.city = city; 
  +    }
  +
  +    /**
  +     * Returns the value of state.
  +     */
  +    public String getState()
  +    {
  +        return state; 
  +    }
  +
  +    /**
  +     * Sets the value of state.
  +     * @param state The value to assign to state.
  +     */
  +    public void setState(String state)
  +    {
  +        this.state = state; 
  +    }
  +
  +    /**
  +     * Returns the value of zip.
  +     */
  +    public String getZip()
  +    {
  +        return zip; 
  +    }
  +
  +    /**
  +     * Sets the value of zip.
  +     * @param zip The value to assign to zip.
  +     */
  +    public void setZip(String zip)
  +    {
  +        this.zip = zip; 
  +    }
  +
  +    /**
  +     * Returns the value of country.
  +     */
  +    public String getCountry()
  +    {
  +        return country; 
  +    }
  +
  +    /**
  +     * Sets the value of country.
  +     * @param country The value to assign to country.
  +     */
  +    public void setCountry(String country)
  +    {
  +        this.country = country; 
  +    }
  +
  +    /**
  +     * Returns the value of type.
  +     */
  +    public String getType()
  +    {
  +        return type; 
  +    }
  +
  +    /**
  +     * Sets the value of type.
  +     * @param type The value to assign to type.
  +     */
  +    public void setType(String type)
  +    {
  +        this.type = type; 
  +    }
   }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org