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


Java ImmutableList.collect方法代码示例

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


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

示例1: convertToParamList

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
private ImmutableList<ImmutableMap<String, String>> convertToParamList(String templateParamAttr) {
    if (templateParamAttr == null) {
        return Lists.immutable.of(Maps.immutable.<String, String>empty());
    }

    ImmutableList<String> paramGroups = ArrayAdapter.adapt(templateParamAttr.split(";")).toImmutable();
    return paramGroups.collect(new Function<String, ImmutableMap<String, String>>() {
        @Override
        public ImmutableMap<String, String> valueOf(String paramGroup) {
            String[] paramStrs = paramGroup.split(",");
            MutableMap<String, String> params = Maps.mutable.empty();
            for (String paramStr : paramStrs) {
                String[] paramParts = paramStr.split("=");
                params.put(paramParts[0], paramParts[1]);
            }

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

示例2: searchRules

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
public ImmutableCollection<DaRule> searchRules(final DaSchema schema, Connection conn) throws SQLException {
    QueryRunner query = new QueryRunner();  // using queryRunner so that we can reuse the connection

    // Do not use ANSI JOIN as it does not work in Sybase 11.x - the SQL below works across all versions
    String sql = "SELECT rul.name as RULE_NAME\n" +
            "FROM " + schema.getName() + "..sysobjects rul\n" +
            "    , sys.schemas sch\n" +
            "WHERE rul.type = 'R'\n" +
            "    and rul.uid = sch.schema_id and sch.name = '" + schema.getSubschemaName() + "' " +
            "and not exists (\n" +
            "\t-- Ensure that the entry is not attached to a table; otherwise, it is a regular table constraint, and will already be dropped when the table is dropped\n" +
            "\tselect 1 from " + schema.getName() + "..sysconstraints c\n" +
            "\twhere c.constid = rul.id\n" +
            ")\n";
    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(query.query(conn, sql, new MapListHandler())).toImmutable();

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

示例3: 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();

    String sql = "SELECT DOMAIN_NAME as USER_TYPE_NAME " +
            "FROM INFORMATION_SCHEMA.DOMAINS " +
            "WHERE DOMAIN_CATALOG = '" + schema.getName() + "' " +
            "AND DOMAIN_SCHEMA = '" + schema.getSubschemaName() + "'";
    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(query.query(conn, sql, 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,代码行数:18,代码来源:MsSqlMetadataDialect.java

示例4: 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 dom.DOMAIN_NAME AS USER_TYPE_NAME\n" +
                    "from INFORMATION_SCHEMA.DOMAINS dom\n" +
                    "WHERE dom.DOMAIN_SCHEMA = ucase('" + schema.getName() + "')\n",
            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,代码行数:19,代码来源:HsqlMetadataDialect.java

示例5: searchRules

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
public ImmutableCollection<DaRule> searchRules(final DaSchema schema, Connection conn) throws SQLException {
    QueryRunner query = new QueryRunner();  // using queryRunner so that we can reuse the connection

    // Do not use ANSI JOIN as it does not work in Sybase 11.x - the SQL below works across all versions
    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(query.query(conn,
            "SELECT rul.name as RULE_NAME\n" +
                    "FROM " + schema.getName() + "..sysobjects rul\n" +
                    "    , " + schema.getName() + "..sysusers sch\n" +
                    "WHERE rul.type = 'R'\n" +
                    "    and rul.uid = sch.uid and sch.name = '" + schema.getSubschemaName() + "' " +
                    "and not exists (\n" +
                    "\t-- Ensure that the entry is not attached to a table; otherwise, it is a regular table constraint, and will already be dropped when the table is dropped\n" +
                    "\tselect 1 from " + schema.getName() + "..sysconstraints c\n" +
                    "\twhere c.constrid = rul.id\n" +
                    ")\n",
            new MapListHandler()
    )).toImmutable();

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

示例6: 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

示例7: DateFormatterPostParsedSqlTranslator

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
/**
 * Creates the translator based on the input format strings in JDK format. We take in the strings here so that we
 * can convert to ThreadLocal underneath the hood. (Joda Time could be an alternative, but the existing unit tests
 * on this class need to pass).
 */
public DateFormatterPostParsedSqlTranslator(ImmutableList<String> dateFormatStrings) {
    this.dateFormats = dateFormatStrings.collect(new Function<String, ThreadLocal<DateFormat>>() {
        @Override
        public ThreadLocal<DateFormat> valueOf(final String dateFormat) {
            return new ThreadLocal<DateFormat>() {
                @Override
                protected DateFormat initialValue() {
                    return new SimpleDateFormat(dateFormat);
                }
            };
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:DateFormatterPostParsedSqlTranslator.java

示例8: validateStructureNew

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
protected void validateStructureNew(TextMarkupDocument doc) {
    String allowedSectionString = Sets.immutable.with(TextMarkupDocumentReader.TAG_METADATA, TextMarkupDocumentReader.TAG_BODY, TextMarkupDocumentReader.TAG_DROP_COMMAND).collect(StringFunctions.prepend("//// ")).makeString(", ");

    ImmutableList<TextMarkupDocumentSection> docSections = doc.getSections();
    if (docSections.isEmpty()) {
        throw new IllegalArgumentException("No content defined");
    }

    ImmutableList<TextMarkupDocumentSection> disallowedSections = docSections.reject(Predicates.attributeIn(TextMarkupDocumentSection.TO_NAME, Sets.immutable.with(null, TextMarkupDocumentReader.TAG_METADATA, TextMarkupDocumentReader.TAG_DROP_COMMAND, TextMarkupDocumentReader.TAG_BODY)));
    if (disallowedSections.notEmpty()) {
        throw new IllegalArgumentException("Only allowed 1 content section and at most 1 of these [" + allowedSectionString + "]; instead, found these disallowed sections: " + disallowedSections);
    }

    ImmutableList<String> sectionNames = docSections.collect(TextMarkupDocumentSection.TO_NAME);
    MutableBag<String> duplicateSections = sectionNames.toBag().selectByOccurrences(IntPredicates.greaterThan(1));
    if (duplicateSections.notEmpty()) {
        throw new IllegalArgumentException("Only allowed 1 content section and at most 1 of these [" + allowedSectionString + "]; instead, found these extra sections instances: " + duplicateSections.toSet());
    }

    int metadataIndex = sectionNames.indexOf(TextMarkupDocumentReader.TAG_METADATA);
    int contentIndex = sectionNames.indexOf(null);
    int dropIndexIndex = sectionNames.indexOf(TextMarkupDocumentReader.TAG_DROP_COMMAND);

    if (metadataIndex != -1 && contentIndex != -1 && metadataIndex > contentIndex) {
        throw new IllegalArgumentException("Improper section ordering: " + TextMarkupDocumentReader.TAG_METADATA + " section must come before the content section");
    } else if (contentIndex != -1 && dropIndexIndex != -1 && contentIndex > dropIndexIndex) {
        throw new IllegalArgumentException("Improper section ordering: content section must come before the " + TextMarkupDocumentReader.TAG_DROP_COMMAND + " section");
    }

}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:32,代码来源:RerunnableChangeParser.java

示例9: searchExtraRoutines

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
public ImmutableCollection<DaRoutine> searchExtraRoutines(final DaSchema schema, String procedureName, Connection conn) throws SQLException {
    String nameClause = procedureName != null ? " and ROUTINE_NAME = '" + procedureName + "'\n" : " ";

    String query = "SELECT" +
            "    ROUTINE_CATALOG," +
            "    ROUTINE_SCHEMA," +
            "    ROUTINE_NAME," +
            "    SPECIFIC_NAME," +
            "    ROUTINE_TYPE," +
            "    OBJECT_DEFINITION(OBJECT_ID(ROUTINE_CATALOG + '.' + ROUTINE_SCHEMA + '.' + ROUTINE_NAME)) AS ROUTINE_DEFINITION" +
            " FROM INFORMATION_SCHEMA.ROUTINES" +
            " WHERE ROUTINE_CATALOG = '" + schema.getName() + "'" +
            " AND ROUTINE_SCHEMA = '" + schema.getSubschemaName() + "'" +
            nameClause;
    QueryRunner qr = new QueryRunner();  // using queryRunner so that we can reuse the connection
    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(qr.query(conn, query, new MapListHandler())).toImmutable();

    return maps.collect(new Function<Map<String, Object>, DaRoutine>() {
        @Override
        public DaRoutine valueOf(Map<String, Object> object) {
            DaRoutineType routineType = DaRoutineType.valueOf(((String) object.get("ROUTINE_TYPE")).toLowerCase());
            return new DaRoutinePojoImpl(
                    (String) object.get("ROUTINE_NAME"),
                    schema,
                    routineType,
                    (String) object.get("SPECIFIC_NAME"),
                    (String) object.get("ROUTINE_DEFINITION")
            );
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:33,代码来源:MsSqlMetadataDialect.java

示例10: searchExtraConstraintIndices

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
public ImmutableCollection<ExtraIndexInfo> searchExtraConstraintIndices(DaSchema schema, String tableName, Connection conn) throws SQLException {
    QueryRunner query = new QueryRunner();  // using queryRunner so that we can reuse the connection

    // Do not use ANSI JOIN as it does not work in Sybase 11.x - the SQL below works across all versions
    String tableClause = tableName == null ? "" : " AND tab.name = '" + tableName + "'";
    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(query.query(conn,
            "select tab.name TABLE_NAME, ind.name INDEX_NAME, status2 & 8 IS_CONSTRAINT, status2 & 512 IS_CLUSTERED " +
                    "from " + schema.getName() + "..sysindexes ind" +
                    ", " + schema.getName() + "..sysobjects tab " +
                    ", " + schema.getName() + "..sysusers sch " +
                    "where ind.id = tab.id " +
                    "and tab.uid = sch.uid and sch.name = '" + schema.getSubschemaName() + "'\n" +
                    tableClause,
            new MapListHandler()
    )).toImmutable();

    return maps.collect(new Function<Map<String, Object>, ExtraIndexInfo>() {
        @Override
        public ExtraIndexInfo valueOf(Map<String, Object> map) {
            return new ExtraIndexInfo(
                    (String) map.get("TABLE_NAME"),
                    (String) map.get("INDEX_NAME"),
                    (Integer) map.get("IS_CONSTRAINT") != 0,
                    (Integer) map.get("IS_CLUSTERED") != 0
            );
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:30,代码来源:SybaseAseMetadataDialect.java

示例11: parseFullPredicate

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
public static Predicate<? super Change> parseFullPredicate(String fullPredicateString) {
    ImmutableList<String> fullPredicateParts = ArrayAdapter.adapt(fullPredicateString.split(PREDICATE_SPLITTER)).toImmutable();
    ImmutableList<Predicate<? super Change>> singlePredicates = fullPredicateParts.collect(new Function<String, Predicate<? super Change>>() {
        @Override
        public Predicate<? super Change> valueOf(String singlePredicateString) {
            return parseSinglePredicate(singlePredicateString);
        }
    });

    return Predicates.or(singlePredicates);
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:12,代码来源:ChangeKeyPredicateBuilder.java

示例12: value

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
public ImmutableList<Change> value(final ChangeType tableChangeType, final FileObject file, final String fileContent, final String nonTokenizedObjectName, final String schema, final TextMarkupDocumentSection packageMetadata) {
    LOG.debug("Attempting to read file {}", file);

    final TextMarkupDocument origDoc = readDocument(fileContent, packageMetadata).getOne();

    final TextMarkupDocumentSection metadata = this.getOrCreateMetadataNode(origDoc);

    String templateParamAttr = metadata.getAttr(ATTR_TEMPLATE_PARAMS);

    // Handle a potential template object; this will return a dummy params list if this is not a template object
    final ImmutableList<ImmutableMap<String, String>> templateParamsList = convertToParamList(templateParamAttr);

    ImmutableList<Pair<String, ImmutableList<Change>>> fileToChangePairs = templateParamsList.collect(new Function<MapIterable<String, String>, Pair<String, ImmutableList<Change>>>() {
        @Override
        public Pair<String, ImmutableList<Change>> valueOf(MapIterable<String, String> templateParams) {

            Tokenizer tokenizer = new Tokenizer(templateParams, "${", "}");

            final String objectName = tokenizer.tokenizeString(nonTokenizedObjectName);
            final TextMarkupDocument doc = templateParams.notEmpty()
                    ? readDocument(tokenizer.tokenizeString(fileContent), packageMetadata).getOne()
                    : origDoc;  /// if no template params, then save some effort and don't bother re-reading the doc from the string

            final ParseDbChange parseDbChange = new ParseDbChange(contentHashStrategy, tableChangeType);

            final ImmutableList<ArtifactRestrictions> fileLevelRestrictions = new DbChangeRestrictionsReader().valueOf(metadata);
            ImmutableList<Change> changes = doc.getSections()
                    .select(Predicates.attributeEqual(TextMarkupDocumentSection.TO_NAME, TextMarkupDocumentReader.TAG_CHANGE))
                    .collect(new Function<TextMarkupDocumentSection, Change>() {
                        private int i = 0;

                        @Override
                        public Change valueOf(TextMarkupDocumentSection section) {

                            ChangeIncremental change = parseDbChange.value(section, schema, objectName, this.i++);
                            ImmutableList<ArtifactRestrictions> changeLevelRestrictions = new DbChangeRestrictionsReader().valueOf(section);
                            change.setRestrictions(mergeRestrictions(fileLevelRestrictions, changeLevelRestrictions));
                            change.setPermissionScheme(getPermissionSchemeValue(doc));
                            change.setFileLocation(file);
                            change.setMetadataSection(metadata);

                            String dependenciesStr = section.getAttr(TextMarkupDocumentReader.ATTR_DEPENDENCIES);
                            if (dependenciesStr != null) {
                                change.setCodeDependencies(Sets.immutable.with(dependenciesStr.split(",")).reject(StringPredicates.empty()).collectWith(CodeDependency.CREATE_WITH_TYPE, CodeDependencyType.EXPLICIT));
                            }

                            String excludeDependenciesStr = section.getAttr(TextMarkupDocumentReader.ATTR_EXCLUDE_DEPENDENCIES);
                            if (excludeDependenciesStr != null) {
                                change.setExcludeDependencies(Sets.immutable.with(excludeDependenciesStr.split(",")).reject(StringPredicates.empty()));
                            }

                            String includeDependenciesStr = metadata.getAttr(TextMarkupDocumentReader.ATTR_INCLUDE_DEPENDENCIES);
                            if (includeDependenciesStr != null) {
                                change.setIncludeDependencies(Sets.immutable.with(includeDependenciesStr.split(",")).reject(StringPredicates.empty()));
                            }

                            return change;
                        }
                    });

            return Tuples.pair(objectName, changes);
        }
    });

    // Validate that if we had used templates, that it resulted in different file names
    MutableSet<String> detemplatedObjectNames = fileToChangePairs.collect(Functions.<String>firstOfPair(), Sets.mutable.<String>empty());

    if (detemplatedObjectNames.size() != templateParamsList.size()) {
        throw new IllegalArgumentException("Expecting the usage of templates to result in a different file name per template set; expected " + templateParamsList.size() + " object names (from " + templateParamAttr + ") but found " + detemplatedObjectNames);
    }

    return fileToChangePairs.flatCollect(Functions.<ImmutableList<Change>>secondOfPair());
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:75,代码来源:TableChangeParser.java

示例13: searchExtraViewInfo

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
public ImmutableCollection<ExtraRerunnableInfo> searchExtraViewInfo(DaSchema schema, String tableName, Connection conn) throws SQLException {
    String query = String.format("select obj.name name, com.number number, colid2 colid2, colid colid, text text\n" +
            "from %1$s..syscomments com\n" +
            ", %1$s..sysobjects obj\n" +
            "    , " + schema.getName() + "..sysusers sch\n" +
            "where com.id = obj.id\n" +
            "and com.texttype = 0\n" +
            "and obj.type in ('V')\n" +
            "and obj.uid = sch.uid and sch.name = '" + schema.getSubschemaName() + "'\n" +
            "order by com.id, number, colid2, colid\n", schema.getName());
    QueryRunner qr = new QueryRunner();  // using queryRunner so that we can reuse the connection
    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(qr.query(conn, query, new MapListHandler())).toImmutable();

    ImmutableList<ExtraRerunnableInfo> viewInfos = maps.collect(new Function<Map<String, Object>, ExtraRerunnableInfo>() {
        @Override
        public ExtraRerunnableInfo valueOf(Map<String, Object> object) {
            return new ExtraRerunnableInfo(
                    (String) object.get("name"),
                    null,
                    (String) object.get("text"),
                    null,
                    ((Integer) object.get("colid2")).intValue(),
                    ((Integer) object.get("colid")).intValue()
            );
        }
    });

    return viewInfos.groupBy(ExtraRerunnableInfo.TO_NAME).multiValuesView().collect(new Function<RichIterable<ExtraRerunnableInfo>, ExtraRerunnableInfo>() {
        @Override
        public ExtraRerunnableInfo valueOf(RichIterable<ExtraRerunnableInfo> objectInfos) {
            MutableList<ExtraRerunnableInfo> sortedInfos = objectInfos.toSortedList(Comparators.fromFunctions(ExtraRerunnableInfo.TO_ORDER2, ExtraRerunnableInfo.TO_ORDER1));
            StringBuilder definitionString = sortedInfos.injectInto(new StringBuilder(), new Function2<StringBuilder, ExtraRerunnableInfo, StringBuilder>() {
                @Override
                public StringBuilder value(StringBuilder sb, ExtraRerunnableInfo rerunnableInfo) {
                    return sb.append(rerunnableInfo.getDefinition());
                }
            });
            return new ExtraRerunnableInfo(
                    sortedInfos.get(0).getName(),
                    null,
                    definitionString.toString()
            );
        }
    }).toList().toImmutable();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:47,代码来源:SybaseAseMetadataDialect.java

示例14: searchExtraRoutines

import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Override
public ImmutableCollection<DaRoutine> searchExtraRoutines(final DaSchema schema, String procedureName, Connection conn) throws SQLException {
    String nameClause = procedureName != null ? "and obj.name = '" + procedureName + "'\n" : "";

    String query = String.format("select obj.name name, obj.type type, com.number number, colid2 colid2, colid colid, text text\n" +
            "from %1$s..syscomments com\n" +
            ", %1$s..sysobjects obj\n" +
            "    , " + schema.getName() + "..sysusers sch\n" +
            "where com.id = obj.id\n" +
            "and com.texttype = 0\n" +
            "and obj.uid = sch.uid and sch.name = '" + schema.getSubschemaName() + "'\n" +
            "and obj.type in ('SF', 'P')\n" +
            nameClause +
            "order by com.id, number, colid2, colid\n", schema.getName());
    QueryRunner qr = new QueryRunner();  // using queryRunner so that we can reuse the connection
    ImmutableList<Map<String, Object>> maps = ListAdapter.adapt(qr.query(conn, query, new MapListHandler())).toImmutable();

    ImmutableList<ExtraRerunnableInfo> routineInfos = maps.collect(new Function<Map<String, Object>, ExtraRerunnableInfo>() {
        @Override
        public ExtraRerunnableInfo valueOf(Map<String, Object> object) {
            String basename = (String) object.get("name");
            int number = ((Integer) object.get("number")).intValue();
            String specificName = number > 1 ? basename + ";" + number : basename;
            return new ExtraRerunnableInfo(
                    basename,
                    specificName,
                    (String) object.get("text"),
                    ((String) object.get("type")).trim(),
                    ((Integer) object.get("colid2")).intValue(),
                    ((Integer) object.get("colid")).intValue()
            );
        }
    });

    return routineInfos.groupBy(ExtraRerunnableInfo.TO_SPECIFIC_NAME).multiValuesView().collect(new Function<RichIterable<ExtraRerunnableInfo>, DaRoutine>() {
        @Override
        public DaRoutine valueOf(RichIterable<ExtraRerunnableInfo> objectInfos) {
            MutableList<ExtraRerunnableInfo> sortedInfos = objectInfos.toSortedList(Comparators.fromFunctions(ExtraRerunnableInfo.TO_ORDER2, ExtraRerunnableInfo.TO_ORDER1));
            StringBuilder definitionString = sortedInfos.injectInto(new StringBuilder(), new Function2<StringBuilder, ExtraRerunnableInfo, StringBuilder>() {
                @Override
                public StringBuilder value(StringBuilder sb, ExtraRerunnableInfo rerunnableInfo) {
                    return sb.append(rerunnableInfo.getDefinition());
                }
            });
            return new DaRoutinePojoImpl(
                    sortedInfos.get(0).getName(),
                    schema,
                    sortedInfos.get(0).getType().equals("P") ? DaRoutineType.procedure : DaRoutineType.function,
                    sortedInfos.get(0).getSpecificName(),
                    definitionString.toString()
            );
        }
    }).toList().toImmutable();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:55,代码来源:SybaseAseMetadataDialect.java


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