/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Factory for {@link FieldRenderer}.
*
* <p>
* This class can be overridden by a plugin to change the code generation
* behavior of XJC. Note that such changes aren't composable; for a given
* schema compilation, only one instance of {@link FieldRendererFactory} is
* used.
*
* <p>
* See {@link Options#fieldRendererFactory}
*
* <p>
* To be more precise, since {@link FieldRenderer} is just a strategy pattern
* and by itself is stateless, the "factory methods" don't necessarily need
* to create new instances of {@link FieldRenderer} --- it can just return
* a set of pre-created instances.
*
* @author Kohsuke Kawaguchi
*/
public class FieldRendererFactory {
return DEFAULT;
}
return ARRAY;
}
return REQUIRED_UNBOXED;
}
return SINGLE;
}
return SINGLE_PRIMITIVE_ACCESS;
}
return new UntypedListFieldRenderer(coreList);
}
return new UntypedListFieldRenderer(coreList, false, true);
}
return new UntypedListFieldRenderer(coreList, true, false);
}
return new ConstFieldRenderer(fallback);
}
= new DefaultFieldRenderer(this);
= new GenericFieldRenderer(ArrayField.class);
= new GenericFieldRenderer(UnboxedField.class);
= new GenericFieldRenderer(SingleField.class);
= new GenericFieldRenderer(SinglePrimitiveAccessField.class);
}