| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.lib; |
| 9 | |
| 10 | import net.sf.saxon.Configuration; |
| 11 | import net.sf.saxon.query.StaticQueryContext; |
| 12 | |
| 13 | /** |
| 14 | * Factory class for creating a customized instance of StaticQueryContext |
| 15 | */ |
| 16 | |
| 17 | public class StaticQueryContextFactory { |
| 18 | |
| 19 | /** |
| 20 | * Create a new instance of {@link StaticQueryContext}. The default implementation |
| 21 | * creates a new {@code StaticQueryContext} as a copy of the {@code Configuration}'s |
| 22 | * default static query context. User implementations are encouraged to do the same, |
| 23 | * but this is not mandatory. If the {@code Configuration}'s default static query context |
| 24 | * is ignored, then configuration settings specific to XQuery (construction mode, |
| 25 | * default element namespace, default function namespace, etc) are ignored for |
| 26 | * queries created under this {@code StaticQueryContext} |
| 27 | * |
| 28 | * @param config the configuration |
| 29 | * @param copyFromDefault true if the properties of the new static query context object |
| 30 | * are to be copied from the default query context object held |
| 31 | * in the Configuration |
| 32 | * @return the new {@code StaticQueryContext} instance |
| 33 | */ |
| 34 | |
| 35 | public StaticQueryContext newStaticQueryContext(Configuration config, boolean copyFromDefault) { |
| 36 | return new StaticQueryContext(config, copyFromDefault); |
| 37 | } |
| 38 | } |