7

I was impressed by google's MapMaker design.I would like to know what is the name of the pattern that is used here ?

( What i think is it's somewhat like decorator pattern but in which we don't have to wrap the object in other object to extend the functionality,but I can't figure out exactly what sort of pattern it is. )

MapMaker Object Creation:-

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);
            }
          });
Emil
  • 13,577
  • 18
  • 69
  • 108
  • 3
    To learn about design patterns by real world examples, you may find [this answer](http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns/2707195#2707195) useful. – BalusC Oct 01 '10 at 12:49
  • 1
    You'll never miss an opportunity to point that one out, eh? :-) Granted: it *is* one of the best java answers on this site... – Sean Patrick Floyd Oct 01 '10 at 13:04
  • 1
    @BaluC:That is surely a great answer,+1 from me. – Emil Oct 01 '10 at 15:37

3 Answers3

14

It is a Builder with a Fluent api

Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
5

Builder and/or Fluent Interface

http://en.wikipedia.org/wiki/Fluent_interface

http://en.wikipedia.org/wiki/Builder_pattern

mindas
  • 26,463
  • 15
  • 97
  • 154
1

I think it's kind of Builder.

Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132