192 * </li> 193 * <li> 194 * <p>Use the service-provider loading facility, defined by the 195 * {@link java.util.ServiceLoader} class, to attempt to locate and load an 196 * implementation of the service using the {@linkplain 197 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}: 198 * the service-provider loading facility will use the {@linkplain 199 * java.lang.Thread#getContextClassLoader() current thread's context class loader} 200 * to attempt to load the service. If the context class 201 * loader is null, the {@linkplain 202 * ClassLoader#getSystemClassLoader() system class loader} will be used. 203 * </li> 204 * <li> 205 * <p>Otherwise, the {@linkplain #newDefaultFactory() system-default} 206 * implementation is returned. 207 * </li> 208 * </ul> 209 * <p> 210 * Once an application has obtained a reference to a XMLInputFactory it 211 * can use the factory to configure and obtain stream instances. 212 * <p> 213 * Note that this is a new method that replaces the deprecated newInstance() method. 214 * No changes in behavior are defined by this replacement method relative to 215 * the deprecated method. 216 * 217 * @throws FactoryConfigurationError in case of {@linkplain 218 * java.util.ServiceConfigurationError service configuration error} or if 219 * the implementation is not available or cannot be instantiated. 220 */ 221 @Deprecated(since="1.7") 222 public static XMLInputFactory newFactory() 223 throws FactoryConfigurationError 224 { 225 return FactoryFinder.find(XMLInputFactory.class, DEFAULIMPL); 226 } 227 228 /** 229 * Create a new instance of the factory 230 * 231 * @param factoryId Name of the factory to find, same as 232 * a property name 233 * @param classLoader classLoader to use 234 * @return the factory implementation 235 * @throws FactoryConfigurationError if an instance of this factory cannot be loaded 236 * 237 * @deprecated This method has been deprecated to maintain API consistency. 238 * All newInstance methods have been replaced with corresponding 239 * newFactory methods. The replacement {@link 240 * #newFactory(java.lang.String, java.lang.ClassLoader)} method 241 * defines no changes in behavior. | 192 * </li> 193 * <li> 194 * <p>Use the service-provider loading facility, defined by the 195 * {@link java.util.ServiceLoader} class, to attempt to locate and load an 196 * implementation of the service using the {@linkplain 197 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}: 198 * the service-provider loading facility will use the {@linkplain 199 * java.lang.Thread#getContextClassLoader() current thread's context class loader} 200 * to attempt to load the service. If the context class 201 * loader is null, the {@linkplain 202 * ClassLoader#getSystemClassLoader() system class loader} will be used. 203 * </li> 204 * <li> 205 * <p>Otherwise, the {@linkplain #newDefaultFactory() system-default} 206 * implementation is returned. 207 * </li> 208 * </ul> 209 * <p> 210 * Once an application has obtained a reference to a XMLInputFactory it 211 * can use the factory to configure and obtain stream instances. 212 * 213 * @throws FactoryConfigurationError in case of {@linkplain 214 * java.util.ServiceConfigurationError service configuration error} or if 215 * the implementation is not available or cannot be instantiated. 216 */ 217 public static XMLInputFactory newFactory() 218 throws FactoryConfigurationError 219 { 220 return FactoryFinder.find(XMLInputFactory.class, DEFAULIMPL); 221 } 222 223 /** 224 * Create a new instance of the factory 225 * 226 * @param factoryId Name of the factory to find, same as 227 * a property name 228 * @param classLoader classLoader to use 229 * @return the factory implementation 230 * @throws FactoryConfigurationError if an instance of this factory cannot be loaded 231 * 232 * @deprecated This method has been deprecated to maintain API consistency. 233 * All newInstance methods have been replaced with corresponding 234 * newFactory methods. The replacement {@link 235 * #newFactory(java.lang.String, java.lang.ClassLoader)} method 236 * defines no changes in behavior. |