本文整理汇总了Java中de.danielbechler.diff.ObjectDifferBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ObjectDifferBuilder类的具体用法?Java ObjectDifferBuilder怎么用?Java ObjectDifferBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectDifferBuilder类属于de.danielbechler.diff包,在下文中一共展示了ObjectDifferBuilder类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getObjectDiffer
import de.danielbechler.diff.ObjectDifferBuilder; //导入依赖的package包/类
/**
* seems not to be threadsafe.
*
* @return
*/
public static ObjectDiffer getObjectDiffer() {
ObjectDiffer objectDiffer = ObjectDifferBuilder.startBuilding().introspection()
.setDefaultIntrospector(new EntityIntrospector()).and().differs()
.register(new PrimitiveArrayDifferFactory()).build();
return objectDiffer;
}
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:12,代码来源:CibetUtil.java
示例2: auditUpdateTicket
import de.danielbechler.diff.ObjectDifferBuilder; //导入依赖的package包/类
private void auditUpdateTicket(Ticket preUpdateTicket, Map<String, String> preUpdateTicketFields, Ticket postUpdateTicket, Map<String, String> postUpdateTicketFields, int eventId) {
DiffNode diffTicket = ObjectDifferBuilder.buildDefault().compare(postUpdateTicket, preUpdateTicket);
DiffNode diffTicketFields = ObjectDifferBuilder.buildDefault().compare(postUpdateTicketFields, preUpdateTicketFields);
FieldChangesSaver diffTicketVisitor = new FieldChangesSaver(preUpdateTicket, postUpdateTicket);
FieldChangesSaver diffTicketFieldsVisitor = new FieldChangesSaver(preUpdateTicketFields, postUpdateTicketFields);
diffTicket.visit(diffTicketVisitor);
diffTicketFields.visit(diffTicketFieldsVisitor);
List<Map<String, Object>> changes = new ArrayList<>(diffTicketVisitor.changes);
changes.addAll(diffTicketFieldsVisitor.changes);
auditingRepository.insert(preUpdateTicket.getTicketsReservationId(), null, eventId,
Audit.EventType.UPDATE_TICKET, new Date(), Audit.EntityType.TICKET, Integer.toString(preUpdateTicket.getId()), changes);
}
开发者ID:alfio-event,项目名称:alf.io,代码行数:15,代码来源:TicketReservationManager.java
示例3: save
import de.danielbechler.diff.ObjectDifferBuilder; //导入依赖的package包/类
public void save(Project entity, User actor) throws ProjectExistsException{
ProjectActivityEvent activtyEvent = new ProjectActivityEvent();
if (entity.getId() == null) {
if (dao.existsWithName(entity.getMachineName())) {
throw new ProjectExistsException(entity.getMachineName());
} else {
activtyEvent.setVerb(ProjectActivityEventVerb.CREATE);
this.initProject(entity, actor);
}
} else {
Project oldEntity = dao.get(entity.getKey());
activtyEvent.setVerb(ProjectActivityEventVerb.EDIT);
DiffNode diffs = ObjectDifferBuilder.buildDefault().compare(entity, oldEntity);
if (diffs.hasChanges()) {
Map<String,EntityDiff> entityDiffs = new LinkedHashMap<String,EntityDiff>();
diffs.visit(new EntityDiffVisitor(entity, oldEntity,entityDiffs));
activtyEvent.setDiffs(entityDiffs);
}
}
dao.save(entity);
activtyEvent.setProject(entity);
activtyEvent.setActor(actor);
activityEventService.registerActivityEvent(activtyEvent);
}
开发者ID:andryfailli,项目名称:teampot,代码行数:31,代码来源:ProjectService.java
示例4: initializeMinimalDiffer
import de.danielbechler.diff.ObjectDifferBuilder; //导入依赖的package包/类
protected final ObjectDifferBuilder initializeMinimalDiffer(ObjectDifferBuilder builder) {
builder = initializeDiffer(builder);
// Allows to include a node without having all its children included
NonInheritingNodePathInclusionResolver parentInclusionResolver = new NonInheritingNodePathInclusionResolver();
builder = builder.inclusion().resolveUsing(parentInclusionResolver).and();
// We make sure, that if no nodes have been specified as included, all the other nodes won't be considered
// as included "by default"
builder = builder.inclusion().resolveUsing(new InclusionResolver() {
@Override
public Inclusion getInclusion(DiffNode node) {
return Inclusion.DEFAULT; // Don't vote
}
@Override
public boolean enablesStrictIncludeMode() {
return true;
}
}).and();
for (BindingRoot<? super T, ?> binding : getMinimalDifferenceFieldsBindings()) {
FieldPath path = FieldPath.fromBinding(binding);
// The node and all its children are included
builder = builder.inclusion().include().node(DiffUtils.toNodePath(path))
.and();
// For it to work, we also need to include the potential parents.
// However we don't use the category system here nor the NodePathInclusionResolver because it would include
// all the children of the parent (the categories are inherited by the children and the NodePathInclusionResolver
// considers that we include all the children of a node.
path = path.parent().get();
while (!path.isRoot()) {
parentInclusionResolver.setInclusion(DiffUtils.toNodePath(path), Inclusion.INCLUDED);
path = path.parent().get();
}
}
return builder;
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:42,代码来源:AbstractGenericEntityDifferenceServiceImpl.java
示例5: builder
import de.danielbechler.diff.ObjectDifferBuilder; //导入依赖的package包/类
public static ObjectDifferBuilder builder() {
return ObjectDifferBuilder.startBuilding();
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:4,代码来源:DiffUtils.java
示例6: actionPerformed
import de.danielbechler.diff.ObjectDifferBuilder; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
final Map2DComponent mapComponent = mapComponentRef.get();
if (mapComponent == null) {
// the MapComponent has been garbage collected already
return;
}
final Map2DPanel mapPanel = mapComponent.getMap2DPanel();
if (mapPanel == null) {
throw new IllegalStateException("Update action could not get a map panel"
+ " from the map component");
}
final Map2DPanelOptions optionsNew = mapComponent.getToolbar().getOptions();
final Map2DPanelOptions optionsOld = mapPanel.getOptions();
// check if anything has changed
DiffNode diff = ObjectDifferBuilder.buildDefault().compare(optionsNew, optionsOld);
if (diff.isUntouched()) {
return;
}
final Runnable postDataLoaded = new Runnable() {
@Override
public void run() {
mapPanel.setOptions(optionsNew);
mapPanel.resetZoomLevels();
mapPanel.setDefaultViewport(null);
mapPanel.initMap();
mapPanel.zoomOut(true, null, true, true);
}
};
DiffNode msLevelChange = diff.getChild("msLevel");
DiffNode mzRangeChange = diff.getChild("mzRange");
if ((msLevelChange != null && msLevelChange.isChanged())
|| (mzRangeChange != null && mzRangeChange.isChanged())) {
// if ms level or mz-range has changed, we need to load the new data
// and unload the old one
Set<Integer> msLevels = Collections.singleton(optionsNew.getMsLevel());
List<DoubleRange> mzRanges;
DoubleRange newMzRange = optionsNew.getMzRange();
if (newMzRange.equals(Map2DPanel.OPT_DISPLAY_ALL_MZ_REGIONS)) {
mzRanges = null;
} else {
mzRanges = Collections.singletonList(newMzRange);
}
final LCMSDataSubset subsetToLoad = new LCMSDataSubset(null, null, msLevels, mzRanges);
String dialogTitle = "Loading data (Update Map Action)";
String progressHandleName = "Updating currently loaded spectra";
final ProgressHandle ph = ProgressHandle.createHandle(progressHandleName);
final Runnable loadData;
loadData = new Runnable() {
@Override
public void run() {
try {
// unload old data
Set<LCMSDataSubset> excludeFutureLoadedSubset = Collections.singleton(subsetToLoad);
mapComponent.unlaodFromAll(excludeFutureLoadedSubset);
// load new data
mapComponent.loadIntoAll(subsetToLoad);
} catch (FileParsingException ex) {
Exceptions.printStackTrace(ex);
} finally {
ph.finish();
}
SwingHelper.invokeOnEDT(postDataLoaded);
}
};
BaseProgressUtils.runOffEventThreadWithProgressDialog(loadData, dialogTitle, ph, false, 0, 300);
ph.start();
} else {
SwingHelper.invokeOnEDT(postDataLoaded);
}
}
开发者ID:chhh,项目名称:batmass,代码行数:80,代码来源:UpdateMapAction.java
注:本文中的de.danielbechler.diff.ObjectDifferBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论