本文整理汇总了Java中org.eclipse.collections.api.block.procedure.Procedure2类的典型用法代码示例。如果您正苦于以下问题:Java Procedure2类的具体用法?Java Procedure2怎么用?Java Procedure2使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Procedure2类属于org.eclipse.collections.api.block.procedure包,在下文中一共展示了Procedure2类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logChangeset
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
private void logChangeset(Changeset changeset) {
deployMetricsCollector.addMetric("changeset.executeCount", changeset.getInserts().size());
deployMetricsCollector.addMetric("changeset.auditCount", changeset.getAuditChanges().size());
deployMetricsCollector.addMetric("changeset.warningCount", changeset.getChangeWarnings().size());
deployMetricsCollector.addMetric("changeset.deferredCount", changeset.getDeferredChanges().size());
MutableBag<String> warningBag = changeset.getChangeWarnings().collect(new Function<ChangeCommandWarning, String>() {
@Override
public String valueOf(ChangeCommandWarning warning) {
return warning.getClass().getName();
}
}).toBag();
warningBag.toMapOfItemToCount().forEachKeyValue(new Procedure2<String, Integer>() {
@Override
public void value(String warningClassName, Integer count) {
deployMetricsCollector.addMetric("changeset.warningTypeCounts." + warningClassName, count);
}
});
}
示例2: adaptAndFilterTables
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
private Map<String, VerifiableTable> adaptAndFilterTables(final Map<String, VerifiableTable> tables, final Function<VerifiableTable, VerifiableTable> adapter)
{
final Map<String, VerifiableTable> target = new LinkedHashMap<>(tables.size());
MapIterate.forEachKeyValue(tables, new Procedure2<String, VerifiableTable>()
{
@Override
public void value(String name, VerifiableTable table)
{
if (tableFilter.accept(name))
{
if (TableVerifier.this.tablesNotToAdapt.contains(name))
{
target.put(name, table);
}
else
{
target.put(name, adapter.valueOf(table));
}
}
}
});
return target;
}
示例3: generateGrantChanges
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
ImmutableList<String> generateGrantChanges(RichIterable<Permission> permsToApply, final DbChangeType changeType, final PhysicalSchema physicalSchema, final String mainObjectName, RichIterable<String> objectNames, final boolean specific) {
final MutableList<String> changes = Lists.mutable.empty();
for (Permission perm : permsToApply) {
for (final Grant grant : perm.getGrants()) {
grant.validate();
for (final String objectName : objectNames) {
grant.getGrantTargets().forEachKeyValue(new Procedure2<GrantTargetType, String>() {
@Override
public void value(GrantTargetType grantTargetType, String grantTarget) {
for (String privilege : grant.getPrivileges()) {
changes.add(createGrant(env, privilege, changeType, physicalSchema, objectName, grantTargetType, grantTarget, specific));
}
}
});
}
}
}
if (LOG.isInfoEnabled()) {
LOG.info(String.format("Applying grants on [%s] with [%d] permission entries on these qualified object names: [%s]",
mainObjectName, permsToApply.size(), objectNames.makeString("; ")));
}
return changes.toImmutable();
}
示例4: AbstractDdlReveng
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
public AbstractDdlReveng(DbPlatform platform, MultiLineStringSplitter stringSplitter, ImmutableList<Predicate<String>> skipPredicates, ImmutableList<RevengPattern> revengPatterns, Procedure2<ChangeEntry, String> postProcessChange) {
this.platform = platform;
this.stringSplitter = stringSplitter;
this.skipPredicates = skipPredicates;
this.revengPatterns = revengPatterns;
Procedure2<ChangeEntry, String> noOpProcedure = new Procedure2<ChangeEntry, String>() {
@Override
public void value(ChangeEntry changeEntry, String s) {
}
};
this.postProcessChange = ObjectUtils.firstNonNull(postProcessChange, noOpProcedure);
}
示例5: MsSqlReveng
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
public MsSqlReveng() {
super(
new MsSqlDbPlatform(),
new MultiLineStringSplitter("GO", true),
Lists.immutable.<Predicate<String>>of(
StringPredicates.contains("-- PostgreSQL database dump").and(StringPredicates.contains("-- Dumped by pg_dump"))
),
getRevengPatterns(),
new Procedure2<ChangeEntry, String>() {
@Override
public void value(ChangeEntry changeEntry, String sql) {
if (sql.contains("\"")) {
changeEntry.addMetadataAnnotation(TextMarkupDocumentReader.TOGGLE_DISABLE_QUOTED_IDENTIFIERS);
}
}
}
);
setStartQuote("\\[");
setEndQuote("\\]");
setSkipLinePredicates(Lists.immutable.<Predicate<String>>of(
StringPredicates.matches(".*\\s*/\\*+\\s+Object")
, StringPredicates.startsWith("/****** Object:")
, StringPredicates.startsWith("SET ANSI_PADDING")
, StringPredicates.startsWith("SET ANSI_NULLS")
, StringPredicates.startsWith("SET QUOTED_IDENTIFIER")
));
setSkipSchemaValidation(true);
}
示例6: AseDdlgenReveng
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
public AseDdlgenReveng() {
super(
new AseDbPlatform(),
MultiLineStringSplitter.createSplitterOnSpaceAndLine("go"),
Lists.immutable.<Predicate<String>>of(
StringPredicates.startsWith("-- Sybase Adaptive Server Enterprise DDL Generator Utility"),
StringPredicates.startsWith("use "),
StringPredicates.startsWith("IF EXISTS ("),
StringPredicates.startsWith("create database"),
StringPredicates.startsWith("------------------------------------------------------------"),
StringPredicates.startsWith("Grant "),
StringPredicates.startsWith("exec sp_addgroup"),
StringPredicates.startsWith("exec sp_adduser"),
StringPredicates.startsWith("setuser"),
StringPredicates.startsWith("SETUSER"),
StringPredicates.startsWith("set quoted_identifier"),
StringPredicates.startsWith("sp_placeobject"),
StringPredicates.startsWith("exec sp_changedbowner"),
StringPredicates.startsWith("exec master.dbo.sp_dboption"),
StringPredicates.startsWith("checkpoint"),
StringPredicates.startsWith("sp_addthreshold"),
StringPredicates.startsWith("exec sp_addalias"),
StringPredicates.startsWith("-- DDLGen Completed")),
getRevengPatterns(),
new Procedure2<ChangeEntry, String>() {
@Override
public void value(ChangeEntry changeEntry, String sql) {
if (sql.contains("\"")) {
changeEntry.addMetadataAnnotation(TextMarkupDocumentReader.TOGGLE_DISABLE_QUOTED_IDENTIFIERS);
}
}
}
);
}
示例7: logChangeMetrics
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
private void logChangeMetrics(final String changeSide, ImmutableList<Change> changes) {
MutableBag<String> changeTypeCounts = changes.collect(Change.TO_CHANGE_TYPE_NAME).toBag();
changeTypeCounts.toMapOfItemToCount().forEachKeyValue(new Procedure2<String, Integer>() {
@Override
public void value(String changeType, Integer count) {
deployMetricsCollector.addMetric("changes." + changeSide + "." + changeType, count);
}
});
}
示例8: forEachWithOccurrences
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
void forEachWithOccurrences(final Procedure2<Object, Integer> procedure)
{
this.bag.topOccurrences(this.maximumCardinalityToCount).forEach(new Procedure<ObjectIntPair<Object>>()
{
@Override
public void value(ObjectIntPair<Object> pair)
{
procedure.value(pair.getOne(), pair.getTwo());
}
});
}
示例9: determineChangeset
import org.eclipse.collections.api.block.procedure.Procedure2; //导入依赖的package包/类
@Override
public Changeset determineChangeset(RichIterable<Change> deploys, final RichIterable<Change> sources,
final boolean rollback, final boolean initAllowedOnHashExceptions, Predicate<? super ExecuteChangeCommand> changesetPredicate) {
final Multimap<ChangeType, Change> deployChangesByType = deploys.groupBy(Change.TO_CHANGE_TYPE);
final Multimap<ChangeType, Change> sourceChangesByType = sources.groupBy(Change.TO_CHANGE_TYPE);
SetIterable<ChangeType> changeTypes = Sets.mutable.withAll(deployChangesByType.keysView()).withAll(sourceChangesByType.keysView());
RichIterable<ChangeCommand> commands = changeTypes.flatCollect(new Function<ChangeType, Iterable<ChangeCommand>>() {
@Override
public Iterable<ChangeCommand> valueOf(ChangeType changeType) {
RichIterable<Change> changeTypeDeploys = deployChangesByType.get(changeType);
RichIterable<Change> changeTypeSources = sourceChangesByType.get(changeType);
final MutableMap<Change, ChangePair> changes = UnifiedMapWithHashingStrategy
.newMap(hashStrategy);
Procedure2<Change, Boolean> addChangeToMap = new Procedure2<Change, Boolean>() {
@Override
public void value(Change change, Boolean fromSource) {
ChangePair changePair = changes.get(change);
if (changePair == null) {
changePair = new ChangePair();
changes.put(change, changePair);
}
if (fromSource) {
changePair.setSourceChange(change);
} else {
changePair.setDeployedChange(change);
}
}
};
changeTypeSources.forEachWith(addChangeToMap, true);
changeTypeDeploys.forEachWith(addChangeToMap, false);
return changeTypeBehaviorRegistry.getChangeTypeBehavior(changeType.getName()).getChangeTypeCalculator().calculateCommands(changeType, changes.valuesView(), sources, rollback, initAllowedOnHashExceptions);
}
});
PartitionIterable<ChangeCommand> executePartition = commands.partition(instanceOf(ExecuteChangeCommand.class));
PartitionIterable<ChangeCommand> auditPartition = executePartition.getRejected().partition(instanceOf(AuditChangeCommand.class));
PartitionIterable<ChangeCommand> warningPartition = auditPartition.getRejected().partition(instanceOf(ChangeCommandWarning.class));
if (warningPartition.getRejected().notEmpty()) {
throw new IllegalStateException("These changes are not of an expected class type: " + executePartition.getRejected());
}
ImmutableList<ExecuteChangeCommand> changeCommands = changeCommandSorter.sort(cast(executePartition.getSelected(), ExecuteChangeCommand.class), rollback);
if (changesetPredicate == null) {
changesetPredicate = DEFAULT_DEFERRED_PREDICATE;
}
PartitionImmutableList<ExecuteChangeCommand> changesetPartition = changeCommands.partition(
changesetPredicate
);
return new Changeset(changesetPartition.getSelected(),
changesetPartition.getRejected(),
cast(auditPartition.getSelected(), AuditChangeCommand.class),
cast(warningPartition.getSelected(), ChangeCommandWarning.class)
);
}