当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableList类代码示例

本文整理汇总了Java中org.eclipse.collections.api.list.ImmutableList的典型用法代码示例。如果您正苦于以下问题:Java ImmutableList类的具体用法?Java ImmutableList怎么用?Java ImmutableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImmutableList类属于org.eclipse.collections.api.list包,在下文中一共展示了ImmutableList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAdditionalTranslators

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
@Override
public ImmutableList<PrepareDbChange> getAdditionalTranslators() {
    SqlTranslatorConfigHelper configHelper = SqlTranslatorConfigHelper.createInMemoryDefault();
    configHelper.setNameMapper(new AseSqlTranslatorNameMapper());
    configHelper.getColumnSqlTranslators()
            .with(new AseToHsqlSqlTranslator());
    configHelper.getPostColumnSqlTranslators()
            .with(new AseToHsqlSqlTranslator());
    configHelper.getPostParsedSqlTranslators()
            .with(new AseToInMemorySqlTranslator())
            .with(new DateFormatterPostParsedSqlTranslator(AseToInMemorySqlTranslator.ACCEPTED_DATE_FORMATS));
    configHelper.getUnparsedSqlTranslators()
            .with(new AseToInMemorySqlTranslator())
            .with(new AseToHsqlDomainSqlTranslator())
            .with(new AseRenameTranslator())
    ;

    return Lists.immutable.<PrepareDbChange>with(new InMemoryTranslator(configHelper));
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:AseToHsqlTranslationDialect.java

示例2: setupUsers

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
private void setupUsers(Connection conn, PhysicalSchema schema, boolean failOnSetupException) {
    MutableSet<String> existingUsers;
    try {
        existingUsers = ListAdapter.adapt(jdbc.query(conn, schema.getPhysicalName() + "..sp_helpuser", new ColumnListHandler<String>("Users_name"))).toSet();
    } catch (DataAccessException e) {
        if (failOnSetupException) {
            throw e;
        } else {
            LOG.warn("User validation query failed; continuing w/ deployment per configuration", e);
            deployMetricsCollector.addMetric(DeployMetrics.WARNINGS_PREFIX + ".aseUserValidationQueryFailure", true);
            return;
        }
    }

    ImmutableList<User> missingUsers = env.getUsers().select(Predicates.attributeNotIn(User.TO_NAME, existingUsers));
    if (missingUsers.notEmpty()) {
        String errorMessage = "Specified users " + missingUsers.collect(User.TO_NAME).makeString("[", ",", "]") + " do not exist in database " + schema.getPhysicalName() + "; please create the users or remove from your configuration (or rely on groups instead for permissions)";
        if (failOnSetupException) {
            throw new IllegalArgumentException(errorMessage);
        } else {
            LOG.warn(errorMessage);
            LOG.warn("Will proceed with deployment as you have configured this to just be a warning");
            deployMetricsCollector.addMetric(DeployMetrics.WARNINGS_PREFIX + ".usersInConfigButNotInDb", errorMessage);
        }
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:27,代码来源:AseEnvironmentInfraSetup.java

示例3: initializeChangeTypes

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
@Override
protected ImmutableList<ChangeType> initializeChangeTypes() {
    MutableList<ChangeType> changeTypes = super.initializeChangeTypes().toList();

    DbChangeType sequenceType = getChangeType(changeTypes, ChangeType.SEQUENCE_STR);
    sequenceType = DbChangeTypeImpl.newDbChangeType(sequenceType).setGrantObjectQualifier("SEQUENCE").build();
    replaceChangeType(changeTypes, sequenceType);

    DbChangeType functionType = getChangeType(changeTypes, ChangeType.FUNCTION_STR);
    functionType = DbChangeTypeImpl.newDbChangeType(functionType).setGrantObjectQualifier("FUNCTION").build();
    replaceChangeType(changeTypes, functionType);

    DbChangeType spType = getChangeType(changeTypes, ChangeType.SP_STR);
    spType = DbChangeTypeImpl.newDbChangeType(spType).setGrantObjectQualifier("PROCEDURE").build();
    replaceChangeType(changeTypes, spType);

    return changeTypes.toImmutable();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:Db2DbPlatform.java

示例4: sortChanges

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
/**
 * Sorts the graph to provide a consistent topological ordering.
 *
 * @param graph          The input graph
 * @param subsetVertices The subset vertices of the graph we want to sort
 * @param comparator     The comparator on which to order the vertices to guarantee a consistent topological ordering
 */
public <T> ImmutableList<T> sortChanges(DirectedGraph<T, DefaultEdge> graph, RichIterable<T> subsetVertices, Comparator<? super T> comparator) {
    if (subsetVertices.toSet().size() != subsetVertices.size()) {
        throw new IllegalStateException("Unexpected state - have some dupe elements here: " + subsetVertices);
    }

    DirectedGraph<T, DefaultEdge> subsetGraph = new DirectedSubgraph<T, DefaultEdge>(
            graph, subsetVertices.toSet(), null);

    // At one point, we _thought_ that the DirectedSubGraph was dropping vertices that don't have edges, so we
    // manually add them back to the graph to ensure that we can still order them.
    // However, that no longer seems to be the case. We add a check here just in case this comes up again.
    if (subsetVertices.size() != subsetGraph.vertexSet().size()) {
        throw new IllegalArgumentException("This case should never happen! [subsetVertices: " + subsetVertices + ", subsetGraphVertices: " + subsetGraph.vertexSet());
    }

    return sortChanges(subsetGraph, comparator);
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:25,代码来源:GraphSorter.java

示例5: getRevengPatterns

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
static ImmutableList<RevengPattern> getRevengPatterns() {
    String schemaNameSubPattern = getSchemaObjectPattern(QUOTE, QUOTE);
    String schemaSysNamePattern = getSchemaObjectWithPrefixPattern(QUOTE, QUOTE, "SYS_");
    NamePatternType namePatternType = NamePatternType.TWO;
    return Lists.immutable.with(
            new RevengPattern(ChangeType.SEQUENCE_STR, namePatternType, "(?i)create\\s+(?:or\\s+replace\\s+)?sequence\\s+" + schemaNameSubPattern).withPostProcessSql(REPLACE_TABLESPACE).withPostProcessSql(REMOVE_QUOTES),
            new RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)create\\s+(?:memory\\s+)table\\s+" + schemaNameSubPattern).withPostProcessSql(REPLACE_TABLESPACE).withPostProcessSql(REMOVE_QUOTES),
            new RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)alter\\s+table\\s+" + schemaNameSubPattern).withPostProcessSql(REMOVE_QUOTES),
            new RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)create\\s+unique\\s+index\\s+" + schemaSysNamePattern + "\\s+on\\s+" + schemaNameSubPattern, 2, 1, "excludeEnvs=\"%\" comment=\"this_is_potentially_a_redundant_primaryKey_index_please_double_check\"").withPostProcessSql(REPLACE_TABLESPACE).withPostProcessSql(REMOVE_QUOTES),
            new RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)create\\s+(?:unique\\s+)index\\s+" + schemaNameSubPattern + "\\s+on\\s+" + schemaNameSubPattern, 2, 1, "INDEX").withPostProcessSql(REPLACE_TABLESPACE).withPostProcessSql(REMOVE_QUOTES),
            new RevengPattern(ChangeType.FUNCTION_STR, namePatternType, "(?i)create\\s+(?:or\\s+replace\\s+)?(?:force\\s+)?(?:editionable\\s+)?function\\s+" + schemaNameSubPattern),
            new RevengPattern(ChangeType.VIEW_STR, namePatternType, "(?i)create\\s+(?:or\\s+replace\\s+)?(?:force\\s+)?(?:editionable\\s+)?view\\s+" + schemaNameSubPattern),
            new RevengPattern(ChangeType.SP_STR, namePatternType, "(?i)create\\s+(?:or\\s+replace\\s+)?procedure\\s+" + schemaNameSubPattern),
            new RevengPattern(ChangeType.USERTYPE_STR, namePatternType, "(?i)create\\s+(?:or\\s+replace\\s+)?type\\s+" + schemaNameSubPattern),
            new RevengPattern(ChangeType.TRIGGER_STR, namePatternType, "(?i)create\\s+or\\s+replace\\s+trigger\\s+" + schemaNameSubPattern)
    );
    //CREATE TYPE SCHEMA1.BOOLEAN2 AS SMALLINT
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:HsqlReveng.java

示例6: assertTest

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
private void assertTest(boolean result, final String platformName, final MutableSet<String> includes,
                        final MutableSet<String> excludes) {
    Environment env = new Environment();

    Platform platform = mock(Platform.class);
    when(platform.getName()).thenReturn(platformName);
    env.setPlatform(platform);

    Restrictable restrictable = new Restrictable() {
        @Override
        public ImmutableList<ArtifactRestrictions> getRestrictions() {
            return Lists.immutable.<ArtifactRestrictions>of(new ArtifactPlatformRestrictions(includes, excludes));
        }
    };

    Assert.assertEquals(result, ArtifactRestrictions.apply().accept(restrictable, env));
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:18,代码来源:ArtifactPlatformRestrictionsTest.java

示例7: readInternal

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
protected ImmutableList<Change> readInternal(E env, final MainDeployerArgs deployerArgs) {
    validateSetup();
    if (deployerArgs.isRollback()) {
        LOG.info("*** EXECUTING IN ROLLBACK MODE ***");
    }
    LOG.info("Now fetching the changed artifacts");

    logArgumentMetrics(deployerArgs);
    logEnvironment(env);
    logEnvironmentMetrics(env);

    ImmutableList<Change> sourceChanges = sourceChangeReader.readSourceChanges(
            deployerArgs.isUseBaseline(),
            and(this.dbChangeFilter, deployerArgs.getChangeInclusionPredicate()));

    for (Change artf : sourceChanges) {
        artf.setEnvironment(env);
    }

    logChanges("source", sourceChanges);

    logChangeMetrics("source", sourceChanges);

    return sourceChanges;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:26,代码来源:MainInputReader.java

示例8: valueOf

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
public ImmutableList<ArtifactRestrictions> valueOf(TextMarkupDocumentSection section) {
    if (section == null) {
        return Lists.immutable.of();
    }

    MutableList<ArtifactRestrictions> restrictions = Lists.mutable.empty();

    Twin<MutableSet<String>> envRestrictions = readRestrictions(section, TextMarkupDocumentReader.INCLUDE_ENVS, TextMarkupDocumentReader.EXCLUDE_ENVS);
    if (envRestrictions != null) {
        restrictions.add(new ArtifactEnvironmentRestrictions(envRestrictions.getOne(), envRestrictions.getTwo()));
    }

    Twin<MutableSet<String>> platformRestrictions = readRestrictions(section, TextMarkupDocumentReader.INCLUDE_PLATFORMS, TextMarkupDocumentReader.EXCLUDE_PLATFORMS);
    if (platformRestrictions != null) {
        restrictions.add(new ArtifactPlatformRestrictions(platformRestrictions.getOne(), platformRestrictions.getTwo()));
    }

    return restrictions.toImmutable();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:DbChangeRestrictionsReader.java

示例9: readSourceChanges

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
@Override
public ImmutableList<Change> readSourceChanges(boolean useBaseline, Predicate<Change> dbChangeFilter) {
    ImmutableList<Change> sourceChanges = this.dbChangeReader
            .readChanges(useBaseline)
            .select(dbChangeFilter);

    CollectionUtil.verifyNoDuplicates(sourceChanges, Change.TO_CHANGE_KEY, "Duplicate changes found - please check your input source files (e.g. no //// " + TextMarkupDocumentReader.TAG_CHANGE + " entries with the same name in a file or files w/ same object names within an environment)");

    // TODO ensure that we've handled the split between static data and others properly
    this.textDependencyExtractor.calculateDependencies(sourceChanges);

    // We tokenize at this point (prior to the changeset calculation) as we'd want to have both the untokenized
    // and tokenized file contents to be hashed so that the change comparison can consider both. The use case
    // here was if the original hash was taken from the untokenized value, but later we change the SQL text to
    // tokenize it -> we don't want that to count as a hash different as the end result of tokenization is still
    // the same
    for (Change change : sourceChanges) {
        this.tokenizeChange(change, env);
    }

    return sourceChanges;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:23,代码来源:SourceChangeReaderImpl.java

示例10: parseString

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
private ImmutableList<TextMarkupDocumentSection> parseString(String text, ImmutableList<String> elementsToCheck, final boolean recurse,
        final String elementPrefix) {

    MutableList<Pair<String, String>> outerSections = splitIntoMainSections(text, elementsToCheck, elementPrefix);

    MutableList<TextMarkupDocumentSection> sections = outerSections.flatCollect(new ConvertOuterSectionToTextSection(recurse, elementPrefix));

    // remove any blank sections
    return sections.toImmutable().reject(new Predicate<TextMarkupDocumentSection>() {
        @Override
        public boolean accept(TextMarkupDocumentSection each) {
            return recurse && each.getName() == null
                    && (StringUtils.isBlank(each.getContent())
                    || StringUtils.isBlank(CommentRemover.removeComments(each.getContent(), "removing on markup document reader"))  // need comments in a separate clause as CommentRemover returns a "null" string on null; will fix eventually
            );
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:TextMarkupDocumentReader.java

示例11: searchUserTypes

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
@Override
public ImmutableCollection<DaUserType> searchUserTypes(final DaSchema schema, Connection conn) throws SQLException {
    QueryRunner query = new QueryRunner();

    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(query.query(conn,
            "SELECT s1.name as USER_TYPE_NAME\n" +
                    "FROM " + schema.getName() + "..systypes s1\n" +
                    "    , " + schema.getName() + "..sysusers sch\n" +
                    "WHERE s1.usertype>100 " +
                    "AND s1.uid = sch.uid and sch.name = '" + schema.getSubschemaName() + "' "
            , new MapListHandler()
    )).toImmutable();

    return maps.collect(new Function<Map<String, Object>, DaUserType>() {
        @Override
        public DaUserType valueOf(Map<String, Object> map) {
            return new DaUserTypeImpl((String) map.get("USER_TYPE_NAME"), schema);
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:21,代码来源:SybaseAseMetadataDialect.java

示例12: parseSinglePredicate

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
@VisibleForTesting
static Predicate<? super Change> parseSinglePredicate(String singlePredicateString) {
    MutableList<String> changeParts = ArrayAdapter.adapt(singlePredicateString.split(SINGLE_PREDICATE_SPLITTER));
    if (changeParts.size() > 4) {
        throw new IllegalArgumentException("Cannot have more than 4 parts here (i.e. splits via the tilde ~)");
    }

    ImmutableList<String> schemas = changeParts.size() > 0 ? parseSinglePredicatePart(changeParts.get(0)) : null;
    ImmutableList<String> changeTypes = changeParts.size() > 1 ? parseSinglePredicatePart(changeParts.get(1)) : null;
    ImmutableList<String> objectNames = changeParts.size() > 2 ? parseSinglePredicatePart(changeParts.get(2)) : null;
    ImmutableList<String> changeNames = changeParts.size() > 3 ? parseSinglePredicatePart(changeParts.get(3)) : null;

    return newBuilder()
            .setSchemas(schemas)
            .setChangeTypes(changeTypes)
            .setObjectNames(objectNames)
            .setChangeNames(changeNames)
            .build();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:ChangeKeyPredicateBuilder.java

示例13: getRevengPatterns

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
private static ImmutableList<RevengPattern> getRevengPatterns() {
    String nameSubPattern = getCatalogSchemaObjectPattern("", "");
    NamePatternType namePatternType = NamePatternType.THREE;
    return Lists.immutable.with(
            new AbstractDdlReveng.RevengPattern(ChangeType.SEQUENCE_STR, namePatternType, "(?i)create\\s+seq(?:uence)?\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)create\\s+table\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)alter\\s+table\\s+" + nameSubPattern + "\\s+add\\s+constraint\\s+" + nameSubPattern + "\\s+foreign\\s+key", 1, 2, "FK"),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)alter\\s+table\\s+" + nameSubPattern + "\\s+add\\s+constraint\\s+" + nameSubPattern, 1, 2, null),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)alter\\s+table\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)create\\s+(?:unique\\s+)?(?:\\w+\\s+)?index\\s+" + nameSubPattern + "\\s+on\\s+" + nameSubPattern, 2, 1, "INDEX"),
            new AbstractDdlReveng.RevengPattern(ChangeType.FUNCTION_STR, namePatternType, "(?i)create\\s+func(?:tion)?\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.VIEW_STR, namePatternType, "(?i)create\\s+view\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.SP_STR, namePatternType, "(?i)create\\s+proc(?:edure)?\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.TRIGGER_STR, namePatternType, "(?i)create\\s+trigger\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.DEFAULT_STR, namePatternType, "(?i)create\\s+default\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.RULE_STR, namePatternType, "(?i)create\\s+rule\\s+" + nameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.USERTYPE_STR, namePatternType, "(?i)^(?:exec\\s+)?sp_addtype\\s+'" + nameSubPattern + "'")
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:AseDdlgenReveng.java

示例14: deploy

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
@Override
public void deploy(final Change change, final CommandExecutionContext cec) {
    sqlExecutor.executeWithinContext(change.getPhysicalSchema(), new Procedure<Connection>() {
        @Override
        public void value(Connection conn) {
            baseArtifactDeployer.deployArtifact(conn, change);
            if (shouldApplyGrants(change)) {
                ImmutableList<Permission> permsToApply = env.getPermissions().select(
                        Predicates.attributePredicate(PERMISSION_TO_SCHEME,
                                StringPredicates.equalsIgnoreCase(change.getPermissionScheme())));

                applyGrants(conn, change.getPhysicalSchema(), change.getObjectName(), permsToApply, cec);
            }
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:17,代码来源:AbstractDbChangeTypeBehavior.java

示例15: getTables

import org.eclipse.collections.api.list.ImmutableList; //导入依赖的package包/类
private ImmutableList<MyInput> getTables() {
    return IntInterval.fromTo(0, numTables - 1).collect(new IntToObjectFunction<MyInput>() {
        @Override
        public MyInput valueOf(int i) {
            MutableSetMultimap<String, String> params = Multimaps.mutable.set.empty();

            int tableNumTypes = tableToTypesRatio.getValue();
            for (int depIndex = 0; depIndex < tableNumTypes; depIndex++) {
                int depNum = rand.nextInt(numTypes);
                params.put("usertype", "usertype" + depNum);
            }

            return new MyInput("table" + i, "table", params, CONVERT_NAME_FUNCTION);
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:17,代码来源:SchemaGenerator.java


注:本文中的org.eclipse.collections.api.list.ImmutableList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。