All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.persistence.internal.jaxb.JaxbClassLoader Maven / Gradle / Ivy

There is a newer version: 5.0.0-B03
Show newest version
/*******************************************************************************
* Copyright (c) 1998, 2013 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 v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* mmacivor - April 25/2008 - 1.0M8 - Initial implementation
******************************************************************************/
package org.eclipse.persistence.internal.jaxb;


import java.lang.reflect.Type;
import java.util.Map;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;

import org.eclipse.persistence.jaxb.TypeMappingInfo;
/**
 * INTERNAL:
 * 

Purpose:Provide a ClassLoader implementation to allow the definition of ASM generated * wrapper classes, and to lookup those classes when required. *

Responsibilities:

    *
  • Wrap the provided ClassLoader and pass method calls along
  • *
  • Maintain a map of generated wrapper classes and attempt lookups in that map if a class isn't found * in the nested loader
  • *
  • Provide a public API to define a class from an array of bytes and a class name
*

This class is a ClassLoader implementation that maintains a map of wrapper classes generated during * JAXB generation. If a class is not found in the nested classLoader, then the map of generated classes * is checked. * @author mmacivor * */ public class JaxbClassLoader extends ClassLoader { private static final String GENERATED_CLASS_NAME = "org.eclipse.persistence.jaxb.generated"; private Map generatedClasses; private AtomicInteger generatedClassCounter = new AtomicInteger(); public JaxbClassLoader(ClassLoader nestedClassLoader) { super(nestedClassLoader); this.generatedClasses = new HashMap(); } public JaxbClassLoader(ClassLoader nestedClassLoader, Class[] classes) { super(nestedClassLoader); this.generatedClasses = new HashMap(); if(classes != null){ for(int i=0; i





© 2015 - 2025 Weber Informatics LLC | Privacy Policy