org.eclipse.persistence.internal.oxm.IDResolver Maven / Gradle / Ivy
Show all versions of eclipselink Show documentation
/*
* Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Blaise Doughan - 2.5 - initial implementation
package org.eclipse.persistence.internal.oxm;
import java.util.Map;
import java.util.concurrent.Callable;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
/**
*
* IDResolver can be subclassed to allow customization of the ID/IDREF processing of
* Unmarshaller. A custom IDResolver can be specified on the Unmarshaller as follows:
*
*
*
*
* IDResolver customResolver = new MyIDResolver();
* unmarshaller.setIDResolver(customResolver);
*
*
* @since EclipseLink 2.5.0
*/
public abstract class IDResolver {
/**
* Default constructor.
*/
protected IDResolver() {
}
/**
*
* Resolve the object of Class type
, uniquely identified by id
.
*
*
* @param id The Object
that uniquely identifies the object to be found.
* @param type The Class
of the object to be found.
*
* @return a Callable
that will return the resolved object.
*
*/
public abstract Callable> resolve(Object id, Class> type) throws SAXException;
/**
*
* Resolve the object of Class type
, uniquely identified by the composite key information specified in the id
Map.
*
*
* @param id A Map
of id values, keyed on the attribute name.
* @param type The Class
of the object to be found.
*
* @return a Callable
that will return the resolved object.
*
*/
public abstract Callable> resolve(Map id, Class> type) throws SAXException;
/**
*
* Bind the object obj
to the identifier id
.
*
*
* @param id The id Object
that uniquely identifies the object to be bound.
* @param obj The object that will be bound to this id.
*
*/
public abstract void bind(Object id, Object obj) throws SAXException;
/**
*
* Bind the object obj
to the composite key information specified in the id
Map.
*
*
* @param id A Map
of id values, keyed on attribute name.
* @param obj The object that will be bound to this id.
*
*/
public abstract void bind(Map id, Object obj) throws SAXException;
/**
*
* Called when unmarshalling begins.
*
*
* @param errorHandler Any errors encountered during the unmarshal process should be reported to this handler.
*
*/
public void startDocument(ErrorHandler errorHandler) throws SAXException {}
/**
*
* Called when unmarshalling ends.
*
*
*/
public void endDocument() throws SAXException {}
}