227 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism} will apply:
228 * That is, the service-provider loading facility will use the {@linkplain
229 * java.lang.Thread#getContextClassLoader() current thread's context class loader}
230 * to attempt to load the service. If the context class
231 * loader is null, the {@linkplain
232 * ClassLoader#getSystemClassLoader() system class loader} will be used.
233 * </li>
234 * <li>
235 * Otherwise, throws a {@link FactoryConfigurationError}.
236 * </li>
237 * </ul>
238 *
239 * @apiNote The parameter factoryId defined here is inconsistent with that
240 * of other JAXP factories where the first parameter is fully qualified
241 * factory class name that provides implementation of the factory.
242 *
243 * <p>
244 * Note that this is a new method that replaces the deprecated
245 * {@link #newInstance(java.lang.String, java.lang.ClassLoader)
246 * newInstance(String factoryId, ClassLoader classLoader)} method.
247 * No changes in behavior are defined by this replacement method relative
248 * to the deprecated method.
249 * </p>
250 *
251 * @param factoryId Name of the factory to find, same as
252 * a property name
253 * @param classLoader classLoader to use
254 * @return the factory implementation
255 * @throws FactoryConfigurationError in case of {@linkplain
256 * java.util.ServiceConfigurationError service configuration error} or if
257 * the implementation is not available or cannot be instantiated.
258 */
259 public static XMLOutputFactory newFactory(String factoryId,
260 ClassLoader classLoader)
261 throws FactoryConfigurationError {
262 //do not fallback if given classloader can't find the class, throw exception
263 return FactoryFinder.find(XMLOutputFactory.class, factoryId, classLoader, null);
264 }
265
266 /**
267 * Create a new XMLStreamWriter that writes to a writer
268 * @param stream the writer to write to
|
227 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism} will apply:
228 * That is, the service-provider loading facility will use the {@linkplain
229 * java.lang.Thread#getContextClassLoader() current thread's context class loader}
230 * to attempt to load the service. If the context class
231 * loader is null, the {@linkplain
232 * ClassLoader#getSystemClassLoader() system class loader} will be used.
233 * </li>
234 * <li>
235 * Otherwise, throws a {@link FactoryConfigurationError}.
236 * </li>
237 * </ul>
238 *
239 * @apiNote The parameter factoryId defined here is inconsistent with that
240 * of other JAXP factories where the first parameter is fully qualified
241 * factory class name that provides implementation of the factory.
242 *
243 * <p>
244 * Note that this is a new method that replaces the deprecated
245 * {@link #newInstance(java.lang.String, java.lang.ClassLoader)
246 * newInstance(String factoryId, ClassLoader classLoader)} method.
247 * The original method was incorrectly defined to return XMLInputFactory.
248 * </p>
249 *
250 * @param factoryId Name of the factory to find, same as
251 * a property name
252 * @param classLoader classLoader to use
253 * @return the factory implementation
254 * @throws FactoryConfigurationError in case of {@linkplain
255 * java.util.ServiceConfigurationError service configuration error} or if
256 * the implementation is not available or cannot be instantiated.
257 */
258 public static XMLOutputFactory newFactory(String factoryId,
259 ClassLoader classLoader)
260 throws FactoryConfigurationError {
261 //do not fallback if given classloader can't find the class, throw exception
262 return FactoryFinder.find(XMLOutputFactory.class, factoryId, classLoader, null);
263 }
264
265 /**
266 * Create a new XMLStreamWriter that writes to a writer
267 * @param stream the writer to write to
|