读书人

Java中运用的的设计模式 - 创建模式

发布时间: 2012-09-06 10:37:01 作者: rapoo

Java中应用的的设计模式 - 创建模式

Creational patterns

Abstract factory?(recognizeable by creational methods returning an abstract/interface type)
  • java.util.Calendar#getInstance()
  • java.util.Arrays#asList()
  • java.util.ResourceBundle#getBundle()
  • java.net.URL#openConnection()
  • java.sql.DriverManager#getConnection()
  • java.sql.Connection#createStatement()
  • java.sql.Statement#executeQuery()
  • java.text.NumberFormat#getInstance()
  • java.lang.management.ManagementFactory?(all?getXXX()?methods)
  • java.nio.charset.Charset#forName()
  • javax.xml.parsers.DocumentBuilderFactory#newInstance()
  • javax.xml.transform.TransformerFactory#newInstance()
  • javax.xml.xpath.XPathFactory#newInstance()

    Builder?(recognizeable by creational methods returning the instance itself)
    • java.lang.StringBuilder#append()?(unsynchronized)
    • java.lang.StringBuffer#append()?(synchronized)
    • java.nio.ByteBuffer#put()?(also on?CharBuffer,?ShortBuffer,?IntBuffer,?LongBuffer,FloatBuffer?and?DoubleBuffer)
    • javax.swing.GroupLayout.Group#addComponent()
    • All implementations of?java.lang.Appendable

      Factory method?(recognizeable by creational methods returning a concrete type)
      • java.lang.Object#toString()?(overrideable in all subclasses)
      • java.lang.Class#newInstance()
      • java.lang.Integer#valueOf(String)?(also on?Boolean,?Byte,?Character,?Short,?Long,Float?and?Double)
      • java.lang.Class#forName()
      • java.lang.reflect.Array#newInstance()
      • java.lang.reflect.Constructor#newInstance()

        Prototype?(recognizeable by creational methods returning a?different?instance of itself with the same properties)
        • java.lang.Object#clone()?(the class has to implement?java.lang.Cloneable)

          Singleton?(recognizeable by creational methods returning the?same?instance (usually of itself) everytime)
          • java.lang.Runtime#getRuntime()
          • java.awt.Desktop#getDesktop()


读书人网 >软件开发

热点推荐