congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IdDefRefMapperBase
Code IndexAdd Tabnine to your IDE (free)

How to use
IdDefRefMapperBase
in
org.jibx.extras

Best Java code snippets using org.jibx.extras.IdDefRefMapperBase (Showing top 2 results out of 315)

origin: org.jibx/jibx-extras

String id = getIdValue(obj);
Object value = map.get(id);
if (value == null) {
  ctx.attribute(0, getAttributeName(), id);
  ctx.closeStartEmpty();
origin: org.jibx/jibx-extras

  public Object unmarshal(Object obj, IUnmarshallingContext ictx)
    throws JiBXException {
    
    // make sure we're at the appropriate start tag
    UnmarshallingContext ctx = (UnmarshallingContext)ictx;
    if (!ctx.isAt(m_uri, m_name)) {
      return null;
    } else {
      
      // check for reference to existing ID
      String id = ctx.attributeText(null, getAttributeName(), null);
      if (id == null) {
        
        // no ID value supplied, unmarshal full definition
        obj = ctx.unmarshalElement();
        
      } else {
        
        // find object based on ID
        obj = ctx.findID(id, 0);
        ctx.parsePastEndTag(m_uri, m_name);
        if (obj == null) {
          ctx.throwStartTagException("Reference to undefined ID " +
            id);
        }
      }
    }
    return obj;
  }
}
org.jibx.extrasIdDefRefMapperBase

Javadoc

Abstract base custom marshaller/unmarshaller for an object that may have multiple references. The first time an object is seen when marshalling the full XML representation is generated; successive uses of the same object then use XML references to the object ID. To use this class you need to create a subclass with a constructor using the same signature as the one provided (calling the base class constructor from your subclass constructor) and implement the abstract #getIdValue(java.lang.Object) method in your subclass. You can also override the provided #getAttributeName() method to change the name used for the IDREF attribute, which must not match the name of an attribute used in the normal marshalled form of the object. The name used for this marshaller/unmarshaller in the mapping definition must match the name used for the base object type being handled.

Most used methods

  • getAttributeName
    Method which can be overridden to supply a different name for the ID reference attribute. The attrib
  • getIdValue
    Get the ID value from object being marshalled.

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now