com.seventytwomiles.architecturerules.domain
Class Rule

java.lang.Object
  extended by com.seventytwomiles.architecturerules.domain.Rule

public class Rule
extends java.lang.Object

Represents a Rule that may not be violoated.

Author:
mikenereson

Constructor Summary
Rule()
          Constructs a new Rule.
Rule(java.lang.String id)
          Instanciates a new Rule with the given id.
Rule(java.lang.String id, java.lang.String packageName)
          Instanciates a new Rule with the given id.
 
Method Summary
 boolean addPackage(java.lang.String packageName)
          
 boolean addViolation(java.lang.String violation)
          Add a new violation to this Rule.
 java.lang.String describe()
          Describes the properties of this rule in an xml-like format.
 java.lang.String describePackges()
           
 boolean equals(java.lang.Object object)
           
 java.lang.String getComment()
          Getter for property comment.
 java.lang.String getDescriptionOfRule()
           
 java.lang.String getId()
          Getter for property id.
 java.util.Collection getPackages()
          Getter for property packages
 java.util.Collection getViolations()
          Get all of the violations.
 int hashCode()
           
 boolean removeViolation(java.lang.String violation)
          Remove a violation from this Rule.
 void setComment(java.lang.String comment)
          Setter for property comment.
 void setId(java.lang.String id)
          Setter for property id.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rule

public Rule()

Constructs a new Rule.


Rule

public Rule(java.lang.String id)

Instanciates a new Rule with the given id.

Parameters:
id - sets the id

Rule

public Rule(java.lang.String id,
            java.lang.String packageName)

Instanciates a new Rule with the given id.

This constructor is to provide some sense of backwards compatability with the releases in series 1 (1.0 and 1.1)

Parameters:
id - sets the id
packageName - a @packages to assert on.
Method Detail

getId

public java.lang.String getId()

Getter for property id.

Returns:
Value for property id.

getComment

public java.lang.String getComment()

Getter for property comment.

Returns:
Value for property comment.

setComment

public void setComment(java.lang.String comment)

Setter for property comment.

Parameters:
comment - Value to set for property comment.

getPackages

public java.util.Collection getPackages()

Getter for property packages

Returns:
Value for property packages.

addPackage

public boolean addPackage(java.lang.String packageName)

Parameters:
packageName - String
Returns:
boolean

removeViolation

public boolean removeViolation(java.lang.String violation)

Remove a violation from this Rule.

Parameters:
violation - String a package this this Rule's package should not test on
Returns:
boolean true if the violation is renived from the List of violoations

addViolation

public boolean addViolation(java.lang.String violation)

Add a new violation to this Rule.

Parameters:
violation - String a package this this Rule's package may NOT depend upon
Returns:
boolean true if the violation is added to the List of violoatizons

getViolations

public java.util.Collection getViolations()

Get all of the violations.

Note: this Collection is unmodifiable, use addViolation(java.lang.String) and removeViolation(java.lang.String)

Returns:
Collection unmodifiable
Throws:
java.lang.UnsupportedOperationException - when getViolations.add(Object) or getViolations.remove(Object) is called. Use addViolation(java.lang.String) and removeViolation(java.lang.String).

setId

public void setId(java.lang.String id)

Setter for property id.

Parameters:
id - Value to set for property id.

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

describe

public java.lang.String describe()

Describes the properties of this rule in an xml-like format.

Returns:
String of xml that describes this Rule.

getDescriptionOfRule

public java.lang.String getDescriptionOfRule()

describePackges

public java.lang.String describePackges()


Copyright © 2007. All Rights Reserved.