本文整理汇总了Java中com.google.common.collect.Multimap.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Multimap.remove方法的具体用法?Java Multimap.remove怎么用?Java Multimap.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Multimap
的用法示例。
在下文中一共展示了Multimap.remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeItem
import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private void removeItem(@NonNull ResourceItem removedItem) {
synchronized (ITEM_MAP_LOCK) {
Multimap<String, ResourceItem> map = getMap(removedItem.getType(), false);
if (map != null) {
map.remove(removedItem.getName(), removedItem);
}
}
}
示例2: setAllInstitutions
import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private synchronized void setAllInstitutions(Map<Long, InstitutionStatus> map)
{
allInstitutions = ImmutableMap.copyOf(map);
Multimap<Long, Institution> newlyAvailable = ArrayListMultimap.create();
Multimap<Long, Institution> newlyUnavailable = ArrayListMultimap.create(availableInstitutions);
Builder<Long, Institution> availableBuilder = ImmutableMultimap.builder();
ImmutableMap.Builder<Long, Long> schemaBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Long, Institution> instBuilder = ImmutableMap.builder();
for( Entry<Long, InstitutionStatus> entry : allInstitutions.entrySet() )
{
InstitutionStatus instStatus = entry.getValue();
Institution institution = instStatus.getInstitution();
Long schemaId = instStatus.getSchemaId();
if( instStatus.isValid() && institution.isEnabled() )
{
availableBuilder.put(schemaId, institution);
if( !newlyUnavailable.remove(schemaId, institution) )
{
newlyAvailable.put(schemaId, institution);
}
}
long uniqueId = institution.getUniqueId();
schemaBuilder.put(uniqueId, schemaId);
instBuilder.put(uniqueId, institution);
}
availableInstitutions = availableBuilder.build();
schemaMap = schemaBuilder.build();
instMap = instBuilder.build();
if( !newlyAvailable.isEmpty() )
{
eventService.publishApplicationEvent(new InstitutionEvent(InstitutionEventType.AVAILABLE, newlyAvailable));
}
if( !newlyUnavailable.isEmpty() )
{
eventService
.publishApplicationEvent(new InstitutionEvent(InstitutionEventType.UNAVAILABLE, newlyUnavailable));
}
}
示例3: translateColumn
import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private EventColumn translateColumn(EventData data, EventColumn scolumn, TableInfoHolder tableHolder,
DataMediaPair dataMediaPair, Multimap<String, String> translateColumnNames) {
EventType type = data.getEventType();
EventColumn tcolumn = new EventColumn();
tcolumn.setNull(scolumn.getColumnValue() == null);
tcolumn.setKey(scolumn.isKey());// 左右两边的主键值必须保持一样,可以不为物理主键
tcolumn.setIndex(scolumn.getIndex());
tcolumn.setUpdate(scolumn.isUpdate());
String columnName = translateColumnName(scolumn.getColumnName(), dataMediaPair, translateColumnNames);
if (StringUtils.isBlank(columnName)) {
throw new TransformException("can't translate column name:" + scolumn.getColumnName() + "in pair:"
+ dataMediaPair.toString());
}
// 特殊处理
// columnName = StringUtils.remove(columnName, "`"); //
// 处理下特殊字符,eromanga给了错误的字段名
tcolumn.setColumnName(columnName);
tcolumn.setColumnType(scolumn.getColumnType());// 不反查,直接使用源库的类型
if (tableHolder != null) {
// modify by ljh at 2013-01-23
// 双向同步新增字段,在一边加了字段后,虽然新的字段没有产生业务变化,但会因为某些原因导致传递了新的字段到T模块
// 此时在目标库并不存在这个字段,导致一直挂起。ps. mysql新增字段时间不是一般的长
// 所以,做了一个容错处理,针对目标库不存在的字段,如果变更记录在源库不存在变更,并且是null值的,允许丢弃该字段(其实最好还是要判断源库的column的defaultValue和当前值是否一致)
boolean canColumnsNotExist = tableHolder.isEnableCompatibleMissColumn();
if (type == EventType.UPDATE) {
// 非变更字段,且当前值为null
canColumnsNotExist &= !scolumn.isUpdate() && scolumn.isNull();
} else if (type == EventType.INSERT) {
// 当前值为null
canColumnsNotExist &= scolumn.isNull();
} else if (type == EventType.DELETE) {
canColumnsNotExist &= !scolumn.isKey(); // 主键不允许不存在
}
Column matchDbColumn = getMatchColumn(tableHolder.getTable().getColumns(), tcolumn.getColumnName());
// 匹配字段为空,可能源库发生过DDL操作,目标库重新载入一下meta信息
if (matchDbColumn == null) { // 尝试reload一下table meta
// 获取目标库的表信息
DbMediaSource dbMediaSource = (DbMediaSource) dataMediaPair.getTarget().getSource();
DbDialect dbDialect = dbDialectFactory.getDbDialect(dataMediaPair.getPipelineId(), dbMediaSource);
String schemaName = tableHolder.getTable().getSchema();
if (StringUtils.isEmpty(schemaName)) {
schemaName = tableHolder.getTable().getCatalog();
}
Table table = dbDialect.findTable(schemaName, tableHolder.getTable().getName(), false); // 强制反查一次,并放入cache
tableHolder.setTable(table);
matchDbColumn = getMatchColumn(tableHolder.getTable().getColumns(), tcolumn.getColumnName());
if (matchDbColumn == null) {
if (canColumnsNotExist) {
return null;
} else {
throw new TransformException(scolumn.getColumnName() + " is not found in " + table.toString()
+ " and source : " + dataMediaPair.getTarget().getNamespace()
+ "." + dataMediaPair.getTarget().getName());
}
}
}
if (tableHolder.isUseTableTransform()) {
int sqlType = matchDbColumn.getTypeCode();
tcolumn.setColumnType(sqlType);
}
}
// if (dataMediaPair.getTarget().getSource().getType().isOracle()) {
// // 特殊处理下oracle编码
// String encodeValue = SqlUtils.encoding(scolumn.getColumnValue(),
// scolumn.getColumnType(),
// dataMediaPair.getSource().getSource().getEncode(),
// dataMediaPair.getTarget().getSource().getEncode());
// tcolumn.setColumnValue(encodeValue);
// } else {
// mysql编码转化已经在驱动层面上完成
tcolumn.setColumnValue(scolumn.getColumnValue());
// }
translateColumnNames.remove(scolumn.getColumnName(), columnName);// 删除映射关系,避免下次重复转换
return tcolumn;
}