代码之家  ›  专栏  ›  技术社区  ›  Emil

地图制作者设计模式?

  •  7
  • Emil  · 技术社区  · 16 年前

    我对谷歌的 MapMaker 设计。我想知道这里使用的图案的名称是什么?

    (我认为它有点像decorator模式,但在这个模式中,我们不需要将对象包装在其他对象中来扩展功能,但我无法确切地确定它是哪种模式。)

    地图制作对象创建:

    ConcurrentMap<Key, Graph> graphs = new MapMaker()
          .concurrencyLevel(32)
          .softKeys()
          .weakValues()
          .expiration(30, TimeUnit.MINUTES)
          .makeComputingMap(
              new Function<Key, Graph>() {
                public Graph apply(Key key) {
                  return createExpensiveGraph(key);
                }
              });
    
    3 回复  |  直到 16 年前
        1
  •  14
  •   Gareth Davis    16 年前
        3
  •  1
  •   Stan Kurilin    16 年前

    推荐文章