Package com.axelor.studio.mapper.diff
Class SchemaDiff
java.lang.Object
com.axelor.studio.mapper.diff.SchemaDiff
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaDiff(com.fasterxml.jackson.databind.JsonNode source, com.fasterxml.jackson.databind.JsonNode target) Create a newSchemaDiffwith the given source and target JSON nodes using the default similarity threshold.SchemaDiff(com.fasterxml.jackson.databind.JsonNode source, com.fasterxml.jackson.databind.JsonNode target, double threshold) Create a newSchemaDiffwith the given source and target JSON nodes and custom similarity threshold. -
Method Summary
Modifier and TypeMethodDescriptioncompute()Compute the differences between the source and target nodes.Get the changes between the source and target nodes.Normalize the changes.
-
Constructor Details
-
SchemaDiff
public SchemaDiff(com.fasterxml.jackson.databind.JsonNode source, com.fasterxml.jackson.databind.JsonNode target) Create a newSchemaDiffwith the given source and target JSON nodes using the default similarity threshold.- Parameters:
source- the source JSON nodetarget- the target JSON node
-
SchemaDiff
public SchemaDiff(com.fasterxml.jackson.databind.JsonNode source, com.fasterxml.jackson.databind.JsonNode target, double threshold) Create a newSchemaDiffwith the given source and target JSON nodes and custom similarity threshold.- Parameters:
source- the source JSON nodetarget- the target JSON nodethreshold- the threshold value between 0 and 1 to determine node similarity
-
-
Method Details
-
getChanges
Get the changes between the source and target nodes.- Returns:
- the changes
-
compute
Compute the differences between the source and target nodes.This method is used to compute the differences between two nodes and create the necessary changes.
It will replace the existing changes with the new ones.
- Returns:
- the same
SchemaDiffinstance
-
normalize
Normalize the changes.This method is used to normalize the changes by normalizing the insert, remove on same nodes to move and re-order the changes based on the preference.
- Remove and Insert on same node are converted to Move
- Changes are re-ordered based in the preference of Update, Insert, Move, Remove
It will replace the existing changes with the normalized ones.
- Returns:
- the same
SchemaDiffinstance
-