net.sf.clirr.core
Class ApiDifference

java.lang.Object
  extended by net.sf.clirr.core.ApiDifference

public final class ApiDifference
extends java.lang.Object

Describes an API change.

Author:
Lars

Constructor Summary
ApiDifference(Message message, Severity binarySeverity, Severity sourceSeverity, java.lang.String clazz, java.lang.String method, java.lang.String field, java.lang.String[] args)
          Create a new API difference representation.
ApiDifference(Message message, Severity severity, java.lang.String clazz, java.lang.String method, java.lang.String field, java.lang.String[] args)
          Invokes the two-severity-level version of this constructor.
 
Method Summary
 java.lang.String getAffectedClass()
          The fully qualified class name of the class that has changed.
 java.lang.String getAffectedField()
          Field name of the field that has changed, if any.
 java.lang.String getAffectedMethod()
          Method signature of the method that has changed, if any.
 Severity getBinaryCompatibilitySeverity()
          The Severity of the API difference in terms of binary compatibility.
 Severity getMaximumSeverity()
          Return the maximum of the binary and source compatibility severities.
 Message getMessage()
          Return the message object (if any) associated with this difference.
 java.lang.String getReport(MessageTranslator translator)
          Human readable api change description.
 Severity getSourceCompatibilitySeverity()
          The Severity of the API difference in terms of source compatibility.
 java.lang.String toString()
          
 java.lang.String toString(MessageTranslator translator)
          Get a human-readable description of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ApiDifference

public ApiDifference(Message message,
                     Severity severity,
                     java.lang.String clazz,
                     java.lang.String method,
                     java.lang.String field,
                     java.lang.String[] args)
Invokes the two-severity-level version of this constructor.


ApiDifference

public ApiDifference(Message message,
                     Severity binarySeverity,
                     Severity sourceSeverity,
                     java.lang.String clazz,
                     java.lang.String method,
                     java.lang.String field,
                     java.lang.String[] args)
Create a new API difference representation.

Parameters:
message - is the key of a human readable string describing the change that was made.
binarySeverity - the severity in terms of binary compatibility, must be non-null.
sourceSeverity - the severity in terms of source code compatibility, must be non-null.
clazz - is the fully-qualified name of the class in which the change occurred, must be non-null.
method - the method signature of the method that changed, null if no method was affected.
field - the field name where the change occured, null if no field was affected.
args - is a set of additional change-specific strings which are made available for the message description string to reference via the standard {n} syntax.
Method Detail

getMessage

public Message getMessage()
Return the message object (if any) associated with this difference.

Checks which support the "new" message API will provide ApiDifference objects with non-null message objects.


getBinaryCompatibilitySeverity

public Severity getBinaryCompatibilitySeverity()
The Severity of the API difference in terms of binary compatibility. ERROR means that clients will definitely break, WARNING means that clients may break, depending on how they use the library. See the eclipse paper for further explanation.

Returns:
the severity of the API difference in terms of binary compatibility.

getSourceCompatibilitySeverity

public Severity getSourceCompatibilitySeverity()
The Severity of the API difference in terms of source compatibility. Sometimes this is different than binary compatibility severity, for example adding a checked exception to a method signature is binary compatible but not source compatible. ERROR means that clients will definitely break, WARNING means that clients may break, depending on how they use the library. See the eclipse paper for further explanation.

Returns:
the severity of the API difference in terms of source code compatibility.

getMaximumSeverity

public Severity getMaximumSeverity()
Return the maximum of the binary and source compatibility severities.


getReport

public java.lang.String getReport(MessageTranslator translator)
Human readable api change description.

Returns:
a human readable description of this API difference.

getAffectedClass

public java.lang.String getAffectedClass()
The fully qualified class name of the class that has changed.

Returns:
fully qualified class name of the class that has changed.

getAffectedMethod

public java.lang.String getAffectedMethod()
Method signature of the method that has changed, if any.

Returns:
method signature or null if no method is affected.

getAffectedField

public java.lang.String getAffectedField()
Field name of the field that has changed, if any.

Returns:
field name or null if no field is affected.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(MessageTranslator translator)
Get a human-readable description of this object. Intended for use by the unit tests.



Copyright © 2003-2005 Lars Kühne. All Rights Reserved.