Class DiffUtil
- java.lang.Object
-
- io.apicurio.registry.rules.compatibility.jsonschema.diff.DiffUtil
-
public class DiffUtil extends Object
- Author:
- Jakub Senko 'jsenko@redhat.com'
-
-
Constructor Summary
Constructors Constructor Description DiffUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
areListOfSchemasCompatible(DiffContext ctx, List<SchemaWrapper> itemSchemas, SchemaWrapper additionalSchema, boolean notReverse)
static void
compareSchema(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, DiffType addedType, DiffType removedType, DiffType bothType, DiffType backwardNotForwardType, DiffType forwardNotBackwardType, DiffType noneType)
static void
compareSchemaWhenExist(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, DiffType bothType, DiffType backwardType, DiffType forwardType, DiffType noneType)
static boolean
diffAddedRemoved(DiffContext ctx, Object original, Object updated, DiffType addedType, DiffType removedType)
added/removedstatic boolean
diffBooleanTransition(DiffContext ctx, Boolean original, Boolean updated, Boolean defaultValue, DiffType changeFalseToTrue, DiffType changeTrueToFalse, DiffType unchanged)
static boolean
diffInteger(DiffContext ctx, Integer original, Integer updated, DiffType addedType, DiffType removedType, DiffType increasedType, DiffType decreasedType)
added/removed/increased/decreasedstatic boolean
diffNumber(DiffContext ctx, Number original, Number updated, DiffType addedType, DiffType removedType, DiffType increasedType, DiffType decreasedType)
added/removed/increased/decreasedstatic void
diffNumberOriginalMultipleOfUpdated(DiffContext ctx, Number original, Number updated, DiffType multipleOfType, DiffType notMultipleOfType)
static void
diffObject(DiffContext ctx, Object original, Object updated, DiffType addedType, DiffType removedType, DiffType changedType)
added/removed/changed (using equals)static void
diffObjectDefault(DiffContext ctx, Object original, Object updated, Object defaultValue, DiffType addedType, DiffType removedType, DiffType changedType)
added/removed/changed (using equals), with a default value specifiedstatic boolean
diffObjectIdentity(DiffContext ctx, Object original, Object updated, Object target, DiffType addedType, DiffType removedType, DiffType extendedType, DiffType narrowedType, DiffType changedType)
added/removed/changed (using ==)static void
diffSchemaOrTrue(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, DiffType bothType, DiffType extendedType, DiffType narrowedType, DiffType noneType)
static <T> void
diffSetChanged(DiffContext ctx, Set<T> original, Set<T> updated, DiffType addedType, DiffType removedType, DiffType changedType, DiffType addedMemberType, DiffType removedMemberType)
static boolean
diffSubschemaAddedRemoved(DiffContext ctx, Object original, Object updated, DiffType addedType, DiffType removedType)
static void
diffSubSchemasAdded(DiffContext ctx, List<SchemaWrapper> addedSchemas, boolean originalPermitsAdditional, SchemaWrapper originalSchemaOfAdditional, boolean updatedPermitsAdditional, DiffType extendedType, DiffType narrowedType, DiffType changedType)
static void
diffSubSchemasRemoved(DiffContext ctx, List<SchemaWrapper> removedSchemas, boolean updatedPermitsAdditional, SchemaWrapper updatedSchemaOfAdditional, boolean originalPermitsAdditional, DiffType narrowedType, DiffType extendedType, DiffType changedType)
static <T> T
getExceptionally(DiffContext ctx, Supplier<T> getter)
Use getter and return null if there is an exception.static boolean
isSchemaCompatible(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, boolean backward)
-
-
-
Method Detail
-
diffAddedRemoved
public static boolean diffAddedRemoved(DiffContext ctx, Object original, Object updated, DiffType addedType, DiffType removedType)
added/removed- Returns:
- true if both objects are present
-
diffSetChanged
public static <T> void diffSetChanged(DiffContext ctx, Set<T> original, Set<T> updated, DiffType addedType, DiffType removedType, DiffType changedType, DiffType addedMemberType, DiffType removedMemberType)
-
diffSubschemaAddedRemoved
public static boolean diffSubschemaAddedRemoved(DiffContext ctx, Object original, Object updated, DiffType addedType, DiffType removedType)
- Returns:
- true if both objects are present
-
diffInteger
public static boolean diffInteger(DiffContext ctx, Integer original, Integer updated, DiffType addedType, DiffType removedType, DiffType increasedType, DiffType decreasedType)
added/removed/increased/decreased- Returns:
- true if the integers are defined and equal
-
diffNumber
public static boolean diffNumber(DiffContext ctx, Number original, Number updated, DiffType addedType, DiffType removedType, DiffType increasedType, DiffType decreasedType)
added/removed/increased/decreased- Returns:
- true if the numbers are the same
-
diffNumberOriginalMultipleOfUpdated
public static void diffNumberOriginalMultipleOfUpdated(DiffContext ctx, Number original, Number updated, DiffType multipleOfType, DiffType notMultipleOfType)
-
diffBooleanTransition
public static boolean diffBooleanTransition(DiffContext ctx, Boolean original, Boolean updated, Boolean defaultValue, DiffType changeFalseToTrue, DiffType changeTrueToFalse, DiffType unchanged)
-
diffObject
public static void diffObject(DiffContext ctx, Object original, Object updated, DiffType addedType, DiffType removedType, DiffType changedType)
added/removed/changed (using equals)
-
diffObjectDefault
public static void diffObjectDefault(DiffContext ctx, Object original, Object updated, Object defaultValue, DiffType addedType, DiffType removedType, DiffType changedType)
added/removed/changed (using equals), with a default value specified
-
diffObjectIdentity
public static boolean diffObjectIdentity(DiffContext ctx, Object original, Object updated, Object target, DiffType addedType, DiffType removedType, DiffType extendedType, DiffType narrowedType, DiffType changedType)
added/removed/changed (using ==)- Returns:
- true if they are equal
-
diffSubSchemasAdded
public static void diffSubSchemasAdded(DiffContext ctx, List<SchemaWrapper> addedSchemas, boolean originalPermitsAdditional, SchemaWrapper originalSchemaOfAdditional, boolean updatedPermitsAdditional, DiffType extendedType, DiffType narrowedType, DiffType changedType)
-
diffSubSchemasRemoved
public static void diffSubSchemasRemoved(DiffContext ctx, List<SchemaWrapper> removedSchemas, boolean updatedPermitsAdditional, SchemaWrapper updatedSchemaOfAdditional, boolean originalPermitsAdditional, DiffType narrowedType, DiffType extendedType, DiffType changedType)
-
diffSchemaOrTrue
public static void diffSchemaOrTrue(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, DiffType bothType, DiffType extendedType, DiffType narrowedType, DiffType noneType)
-
compareSchema
public static void compareSchema(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, DiffType addedType, DiffType removedType, DiffType bothType, DiffType backwardNotForwardType, DiffType forwardNotBackwardType, DiffType noneType)
-
compareSchemaWhenExist
public static void compareSchemaWhenExist(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, DiffType bothType, DiffType backwardType, DiffType forwardType, DiffType noneType)
-
areListOfSchemasCompatible
public static boolean areListOfSchemasCompatible(DiffContext ctx, List<SchemaWrapper> itemSchemas, SchemaWrapper additionalSchema, boolean notReverse)
-
isSchemaCompatible
public static boolean isSchemaCompatible(DiffContext ctx, org.everit.json.schema.Schema original, org.everit.json.schema.Schema updated, boolean backward)
-
getExceptionally
public static <T> T getExceptionally(DiffContext ctx, Supplier<T> getter)
Use getter and return null if there is an exception.
-
-