本文整理匯總了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;
}