1 /* 2 * Copyright 2010 Capgemini 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 */ 16 package org.xmlfield.core.api; 17 18 import java.util.Map; 19 20 import org.xmlfield.core.internal.XmlFieldFactory; 21 22 /** 23 * <p> 24 * An <code>XmlFieldNodeParserFactory</code> instance can be used to create 25 * {@link XmlFieldNodeParser} objects. 26 * </p> 27 * 28 * <p> 29 * Thread safety : 30 * <ul> 31 * <li>Factories implementation <b>must</b> be thread-safe. They will be created 32 * once and reused by XmlField for every thread.</li> 33 * <li>Objects returned by factory should be considered <b>not thread safe</b>. 34 * Default behavior is to return a new object every time. However, if these 35 * objects are know to be thread safe, the factory can always return the same 36 * object for better performances.</li> 37 * </ul> 38 * </p> 39 * <p> 40 * See {@link #newInstance()} for lookup mechanism. 41 * </p> 42 * 43 * @author Guillaume Mary <guillaume.mary@capgemini.com> 44 */ 45 public abstract class XmlFieldNodeParserFactory extends XmlFieldFactory { 46 /** 47 * <p> 48 * Get a new <code>XmlFieldNodeParserFactory</code> instance. 49 * 50 * @return Instance of an <code>XmlFieldNodeParserFactory</code>. 51 * 52 * @throws RuntimeException 53 * When there is a failure in creating an 54 * <code>XmlFieldNodeParserFactory</code> 55 */ 56 public static final XmlFieldNodeParserFactory newInstance() { 57 return newInstance(XmlFieldNodeParserFactory.class); 58 } 59 60 /** 61 * <p> 62 * Return a new <code>XmlFieldNodeParser</code> using the underlying object 63 * model determined when the <code>XmlFieldParserFactory</code> was 64 * instantiated. 65 * </p> 66 * 67 * @return New instance of an <code>XmlFieldParser</code>. 68 */ 69 public abstract XmlFieldNodeParser newParser( 70 Map<String, String> configuration); 71 }