📄 abstractfactory.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_13) on Tue Jun 05 11:36:21 GMT-05:00 2007 --><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>AbstractFactory (Geotools 2.3.x 2.3.2 API)</TITLE><META NAME="keywords" CONTENT="org.geotools.factory.AbstractFactory class"><META NAME="keywords" CONTENT="MINIMUM_PRIORITY"><META NAME="keywords" CONTENT="NORMAL_PRIORITY"><META NAME="keywords" CONTENT="MAXIMUM_PRIORITY"><META NAME="keywords" CONTENT="priority"><META NAME="keywords" CONTENT="hints"><META NAME="keywords" CONTENT="getPriority()"><META NAME="keywords" CONTENT="getImplementationHints()"><META NAME="keywords" CONTENT="onRegistration()"><META NAME="keywords" CONTENT="onDeregistration()"><META NAME="keywords" CONTENT="hashCode()"><META NAME="keywords" CONTENT="equals()"><META NAME="keywords" CONTENT="toString()"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="AbstractFactory (Geotools 2.3.x 2.3.2 API)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AbstractFactory.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../org/geotools/factory/BasicFactories.html" title="class in org.geotools.factory"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="AbstractFactory.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.geotools.factory</FONT><BR>Class AbstractFactory</H2><PRE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <IMG SRC="../../../resources/inherit.gif" ALT="extended by"><B>AbstractFactory</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../org/geotools/factory/Factory.html" title="interface in org.geotools.factory">Factory</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/javax/imageio/spi/RegisterableService.html" title="class or interface in javax.imageio.spi">RegisterableService</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../org/geotools/factory/FactoryUsingVolatileDependencies.html" title="class in org.geotools.factory">FactoryUsingVolatileDependencies</A>, <A HREF="../../../org/geotools/coverage/grid/GridCoverageFactory.html" title="class in org.geotools.coverage.grid">GridCoverageFactory</A>, <A HREF="../../../org/geotools/referencing/factory/ReferencingFactory.html" title="class in org.geotools.referencing.factory">ReferencingFactory</A></DD></DL><HR><DL><DT>public class <B>AbstractFactory</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../org/geotools/factory/Factory.html" title="interface in org.geotools.factory">Factory</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/javax/imageio/spi/RegisterableService.html" title="class or interface in javax.imageio.spi">RegisterableService</A></DL><P>Skeletal implementation of factories. This base classe provides no methods, (they must be provided by subclasses), but provides two convenience features: <p> <ul> <li>An initially empty <A HREF="../../../org/geotools/factory/AbstractFactory.html#hints">map of hints</A> to be filled by subclasses constructors. They are the hints to be returned by <A HREF="../../../org/geotools/factory/AbstractFactory.html#getImplementationHints()"><CODE>getImplementationHints()</CODE></A>.</li> <li>An automatic <A HREF="http://java.sun.com/j2se/1.4/docs/api/javax/imageio/spi/ServiceRegistry.html#setOrdering(java.lang.Class, java.lang.Object, java.lang.Object)" title="class or interface in javax.imageio.spi">ordering</A> applied on the basis of subclasses-provided <A HREF="../../../org/geotools/factory/AbstractFactory.html#priority">priority</A> rank.</li> </ul> <p> When more than one factory implementation is <A HREF="http://java.sun.com/j2se/1.4/docs/api/javax/imageio/spi/ServiceRegistry.html#registerServiceProvider(java.lang.Object)" title="class or interface in javax.imageio.spi">registered</A> for the same category (i.e. they implement the same <A HREF="../../../org/geotools/factory/Factory.html" title="interface in org.geotools.factory"><CODE>Factory</CODE></A> sub-interface), the actual instance to be used is selected according their <A HREF="http://java.sun.com/j2se/1.4/docs/api/javax/imageio/spi/ServiceRegistry.html#setOrdering(java.lang.Class, java.lang.Object, java.lang.Object)" title="class or interface in javax.imageio.spi">ordering</A> and user-supplied <A HREF="../../../org/geotools/factory/Hints.html" title="class in org.geotools.factory">hints</A>. Hints have precedence. If more than one factory matches the hints (including the common case where the user doesn't provide any hint at all), then ordering matter. <p> The ordering is unspecified for every pairs of factories with the same <A HREF="../../../org/geotools/factory/AbstractFactory.html#priority">priority</A>. This implies that the ordering is unspecified between all factories created with the <A HREF="../../../org/geotools/factory/AbstractFactory.html#AbstractFactory()">default constructor</A>, since they all have the same <A HREF="../../../org/geotools/factory/AbstractFactory.html#NORMAL_PRIORITY">default priority</A> level. <h3>How hints are set</h3> Hints are used for two purposes. The distinction is important because the set of hints may not be identical in both cases: <p> <ol> <li>Hints are used for creating new factories.</li> <li>Hints are used in order to check if an <em>existing</em> factory is suitable.</li> </ol> <p> do <strong>not</strong> provides any facility for the first case. Factories implementations shall inspect themselves all relevant hints supplied by the user, and pass them to any dependencies. Do <strong>not</strong> use the <A HREF="../../../org/geotools/factory/AbstractFactory.html#hints"><CODE>hints</CODE></A> field for that; use the hints provided by the user in the constructor. If all dependencies are created at construction time (<cite>constructor injection</cite>), there is no need to keep user's hints once the construction is finished. <p> The <A HREF="../../../org/geotools/factory/AbstractFactory.html#hints"><CODE>hints</CODE></A> field is for the second case only. Implementations shall copy in this field only the user's hints that are know to be relevant to this factory. If a hint is relevant but the user didn't specified any value, the hint key should be added to the <A HREF="../../../org/geotools/factory/AbstractFactory.html#hints"><CODE>hints</CODE></A> map anyway with a value. Only direct dependencies shall be put in the <A HREF="../../../org/geotools/factory/AbstractFactory.html#hints"><CODE>hints</CODE></A> map. Indirect dependencies (i.e. hints used by other factories used by this factory) will be inspected automatically by <A HREF="../../../org/geotools/factory/FactoryRegistry.html" title="class in org.geotools.factory"><CODE>FactoryRegistry</CODE></A> in a recursive way. <p> <strong>Note:</strong> The lack of constructor expecting a <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Map.html" title="class or interface in java.util"><CODE>Map</CODE></A> argument is intentional. This is in order to discourage blind-copy of all user-supplied hints to the <A HREF="../../../org/geotools/factory/AbstractFactory.html#hints"><CODE>hints</CODE></A> map. <p> <strong>Example:</strong> Lets two factories, A and B. Factory A need an instance of Factory B. Factory A can be implemented as below: <table border='1'> <tr><th>Code</th><th>Observations</th></tr> <tr><td><blockquote><pre> class FactoryA extends AbstractFactory { FactoryB fb; FactoryA(Hints userHints) { fb = FactoryFinder.getFactoryB(userHints); this.hints.put(Hints.FACTORY_B, fb); } } </pre></blockquote></td> <td> <ul> <li>The user-supplied map () is never modified.</li> <li>All hints relevant to other factories are used in the constructor. Hints relevant to factory B are used when is invoked.</li> <li>The constructor stores only the hints relevant to . Indirect dependencies (e.g. hints relevant to ) will be inspected recursively by <A HREF="../../../org/geotools/factory/FactoryRegistry.html" title="class in org.geotools.factory"><CODE>FactoryRegistry</CODE></A>.</li> <li>In the above example, <A HREF="../../../org/geotools/factory/AbstractFactory.html#hints"><CODE>hints</CODE></A> will never be used for creating new factories.</li> </ul> </td></tr></table><P><P><DL><DT><B>Since:</B></DT> <DD>2.1</DD><DT><B>Author:</B></DT> <DD>Martin Desruisseaux</DD><DT><B>Module:</B></DT><DD><CODE><B>module/referencing</B></CODE> (<A HREF="http://maven.geotools.fr/repository/org/geotools/gt2-referencing/"><CODE>gt2-referencing.jar</CODE></A>) (<A HREF="http://maven.geotools.fr/reports/referencing/index.html">Maven report</A>) (<A HREF="http://svn.geotools.org/geotools/tags/2.3.2/module/referencing/src/org/geotools/factory/AbstractFactory.java">SVN head</A>)</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/factory/AbstractFactory.html#hints">hints</A></B></CODE><BR> The <A HREF="../../../org/geotools/factory/Factory.html#getImplementationHints()">implementation hints</A>. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/factory/AbstractFactory.html#MAXIMUM_PRIORITY">MAXIMUM_PRIORITY</A></B></CODE><BR> The maximum priority for a factory, which is 100. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/factory/AbstractFactory.html#MINIMUM_PRIORITY">MINIMUM_PRIORITY</A></B></CODE><BR> The minimum priority for a factory, which is 1. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -