org.semver
Class Checker

java.lang.Object
  extended by org.semver.Checker

public class Checker
extends java.lang.Object

Allows to compare content of JARs. Provides convenient methods to validate that chosen Version are correct.


Nested Class Summary
static class Checker.CompatibilityType
          Library compatibility type.
 
Constructor Summary
Checker()
           
 
Method Summary
protected  void accumulateAccessDetails(java.lang.String access, boolean previousAccess, boolean currentAccess, java.util.List<java.lang.String> added, java.util.List<java.lang.String> removed)
           
 Checker.CompatibilityType check(java.io.File previousJAR, java.io.File currentJAR, java.util.Set<java.lang.String> includes, java.util.Set<java.lang.String> excludes)
           
protected  Checker.CompatibilityType computeCompatibilityType(java.util.Set<AccumulatingDiffHandler.Difference> differences)
           
protected  boolean contains(java.util.Set<AccumulatingDiffHandler.Difference> differences, java.lang.Class<? extends AccumulatingDiffHandler.Difference> type)
           
 java.util.Set<AccumulatingDiffHandler.Difference> diff(java.io.File previousJAR, java.io.File currentJAR, java.util.Set<java.lang.String> includes, java.util.Set<java.lang.String> excludes)
           
 void dumpDiff(java.io.File previousJAR, java.io.File currentJAR, java.util.Set<java.lang.String> includes, java.util.Set<java.lang.String> excludes)
          Dumps on System.out all differences between both JARs.
protected  java.lang.String extractAccessDetails(org.osjava.jardiff.AbstractInfo previousInfo, org.osjava.jardiff.AbstractInfo currentInfo)
           
protected  java.lang.String extractActionType(AccumulatingDiffHandler.Difference difference)
           
protected  java.lang.String extractDetails(org.osjava.jardiff.AbstractInfo info)
           
protected  java.lang.String extractDetails(AccumulatingDiffHandler.Difference difference)
           
protected  java.lang.String extractInfoType(org.osjava.jardiff.AbstractInfo info)
           
 Version infer(Version previous, java.io.File previousJAR, java.io.File currentJAR, java.util.Set<java.lang.String> includes, java.util.Set<java.lang.String> excludes)
           
static Version inferNextVersion(Version version, Checker.CompatibilityType compatibilityType)
          Infers next Version depending on provided Checker.CompatibilityType.
static boolean isTypeCompatible(Checker.CompatibilityType compatibilityType, Version.Type type)
           
static void main(java.lang.String[] arguments)
           
 boolean validate(Version previous, java.io.File previousJAR, Version current, java.io.File currentJAR, java.util.Set<java.lang.String> includes, java.util.Set<java.lang.String> excludes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Checker

public Checker()
Method Detail

inferNextVersion

public static Version inferNextVersion(@Nonnull
                                       Version version,
                                       @Nonnull
                                       Checker.CompatibilityType compatibilityType)
Infers next Version depending on provided Checker.CompatibilityType.

Parameters:
version -
compatibilityType -
Returns:

isTypeCompatible

public static boolean isTypeCompatible(Checker.CompatibilityType compatibilityType,
                                       Version.Type type)
Parameters:
compatibilityType -
type -
Returns:
true if specified Checker.CompatibilityType

diff

public final java.util.Set<AccumulatingDiffHandler.Difference> diff(java.io.File previousJAR,
                                                                    java.io.File currentJAR,
                                                                    java.util.Set<java.lang.String> includes,
                                                                    java.util.Set<java.lang.String> excludes)
                                                             throws java.io.IOException,
                                                                    java.io.FileNotFoundException
Parameters:
previousJAR -
currentJAR -
includes -
excludes -
Returns:
all AccumulatingDiffHandler.Difference between both JARs
Throws:
java.io.IOException
java.io.FileNotFoundException

extractActionType

protected final java.lang.String extractActionType(AccumulatingDiffHandler.Difference difference)

extractInfoType

protected final java.lang.String extractInfoType(org.osjava.jardiff.AbstractInfo info)

extractDetails

protected final java.lang.String extractDetails(AccumulatingDiffHandler.Difference difference)

extractDetails

protected final java.lang.String extractDetails(org.osjava.jardiff.AbstractInfo info)

accumulateAccessDetails

protected final void accumulateAccessDetails(java.lang.String access,
                                             boolean previousAccess,
                                             boolean currentAccess,
                                             java.util.List<java.lang.String> added,
                                             java.util.List<java.lang.String> removed)

extractAccessDetails

protected final java.lang.String extractAccessDetails(org.osjava.jardiff.AbstractInfo previousInfo,
                                                      org.osjava.jardiff.AbstractInfo currentInfo)

dumpDiff

public final void dumpDiff(java.io.File previousJAR,
                           java.io.File currentJAR,
                           java.util.Set<java.lang.String> includes,
                           java.util.Set<java.lang.String> excludes)
                    throws java.io.IOException,
                           java.io.FileNotFoundException
Dumps on System.out all differences between both JARs.

Parameters:
previousJAR -
currentJAR -
includes -
excludes -
Throws:
java.io.IOException
java.io.FileNotFoundException

contains

protected final boolean contains(java.util.Set<AccumulatingDiffHandler.Difference> differences,
                                 java.lang.Class<? extends AccumulatingDiffHandler.Difference> type)

computeCompatibilityType

protected final Checker.CompatibilityType computeCompatibilityType(java.util.Set<AccumulatingDiffHandler.Difference> differences)
Parameters:
differences -
Returns:
Checker.CompatibilityType based on specified AccumulatingDiffHandler.Difference

check

public final Checker.CompatibilityType check(java.io.File previousJAR,
                                             java.io.File currentJAR,
                                             java.util.Set<java.lang.String> includes,
                                             java.util.Set<java.lang.String> excludes)
                                      throws java.io.IOException,
                                             java.io.FileNotFoundException
Throws:
java.io.IOException
java.io.FileNotFoundException

infer

public final Version infer(Version previous,
                           java.io.File previousJAR,
                           java.io.File currentJAR,
                           java.util.Set<java.lang.String> includes,
                           java.util.Set<java.lang.String> excludes)
                    throws java.io.IOException
Parameters:
previous -
previousJAR -
currentJAR -
includes -
excludes -
Returns:
an inferred Version for current JAR based on previous JAR content/version.
Throws:
java.io.IOException

validate

public final boolean validate(Version previous,
                              java.io.File previousJAR,
                              Version current,
                              java.io.File currentJAR,
                              java.util.Set<java.lang.String> includes,
                              java.util.Set<java.lang.String> excludes)
                       throws java.io.IOException
Parameters:
previous -
previousJAR -
current -
currentJAR -
includes -
excludes -
Returns:
true if Version provided for current JAR is compatible with previous JAR content/version.
Throws:
java.io.IOException

main

public static void main(java.lang.String[] arguments)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2010. All Rights Reserved.