Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
   * JBoss, Home of Professional Open Source
   * Copyright 2005, JBoss Inc., and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
package org.jboss.xb.binding;
Direct implementations of ObjectModelFactory interface can be thought of as "typed" factories in a sense that parameter types of newChild, addChild and setValue methods (discovered by the framework at runtime with introspection) are supposed to be of specific Java classes (other than java.lang.Object) from the target class hierarchy.

In this interface, newChild, addChild and setValue methods are defined with arguments of type java.lang.Object.
The framework won't introspect an implementation of this interface for "typed" implementations of newChild, addChild and setValue methods. Instead it will call the declared generic methods and it's the responsibility of the implementation of this interface to recognize the types and build the object graph appropriately.

Author(s):
Alexey Loubyansky
Version:
$Revision: 1958 $
public interface GenericObjectModelFactory
   extends ObjectModelFactory
{
   
This method is called when parsing of a new not top-level XML element started. The method should either return an object that represents this XML element in the Java object model or null if this XML element is not represented in the Java object model.

Parameters:
parent an object that represents the parent XML element in the object model
ctx unmarshalling context
namespaceURI namespace URI of the XML element
localName local name of the XML element
attrs attributes of the XML element
Returns:
an object that represents the XML element in the Java object model or null
   Object newChild(Object parentUnmarshallingContext ctxString namespaceURIString localNameAttributes attrs);

   
This method is called when parsing of a not top-level XML element completed. The object that represents this XML element in the Java model should now be completely initialized. An implementation of this method could validate the object that represents the XML element in the Java object model and add it to the parent.

Parameters:
parent an object that represents the parent XML element in the object model
child an object that was returned by the newChild method that was called when parsing of this XML element started
ctx unmarshalling context
namespaceURI namespace URI of the XML element
localName local name of the XML element
   void addChild(Object parentObject childUnmarshallingContext ctxString namespaceURIString localName);

   
This method is called when a new not top-level simple XML element (with text content) was parsed. Such elements are usually mapped to fields in Java classes. So, usually, an implementation of this method will set the field the XML element is bound to in the parent object to the parsed value possibly applying some unmarshalling rule for it.

Parameters:
o an object that represents the parent XML element in the Java object model
ctx unmarshalling context
namespaceURI namespace URI of the XML element
localName local name of the XML element
value value of the XML element as it appears in the XML content
   void setValue(Object oUnmarshallingContext ctxString namespaceURIString localNameString value);
New to GrepCode? Check out our FAQ X