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

org.eclipse.persistence.internal.sessions.factories.OXMObjectPersistenceRuntimeXMLProject Maven / Gradle / Ivy

There is a newer version: 4.0.2
Show newest version
/*
 * Copyright (c) 1998, 2018 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:
//     Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.internal.sessions.factories;

import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.internal.sessions.factories.NamespaceResolvableProject;
import org.eclipse.persistence.internal.sessions.factories.NamespaceResolverWithPrefixes;
import org.eclipse.persistence.oxm.XMLDescriptor;
import org.eclipse.persistence.oxm.mappings.XMLBinaryDataCollectionMapping;
import org.eclipse.persistence.oxm.mappings.XMLBinaryDataMapping;
import org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping;
import org.eclipse.persistence.oxm.mappings.XMLDirectMapping;

/**
 *  INTERNAL:
 *  

Purpose: Defines descriptors for any EclipseLink OXM objects that may * have separate classpath dependencies from the rest of TopLink.

* @author mmacivor * @since 10.1.3 */ public class OXMObjectPersistenceRuntimeXMLProject extends NamespaceResolvableProject { public OXMObjectPersistenceRuntimeXMLProject() { super(); } public OXMObjectPersistenceRuntimeXMLProject(NamespaceResolverWithPrefixes namespaceResolverWithPrefixes) { super(namespaceResolverWithPrefixes); } @Override protected void buildDescriptors() { addDescriptor(buildXMLBinaryDataMappingDescriptor()); addDescriptor(buildXMLBinaryDataCollectionMappingDescriptor()); } public ClassDescriptor buildXMLBinaryDataMappingDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(XMLBinaryDataMapping.class); descriptor.getInheritancePolicy().setParentClass(XMLDirectMapping.class); XMLDirectMapping swaRefMapping = new XMLDirectMapping(); swaRefMapping.setAttributeName("isSwaRef"); swaRefMapping.setXPath(getPrimaryNamespaceXPath() + "is-swa-ref/text()"); descriptor.addMapping(swaRefMapping); XMLDirectMapping mimeTypeMapping = new XMLDirectMapping(); mimeTypeMapping.setAttributeName("mimeTypePolicy"); mimeTypeMapping.setGetMethodName("getMimeType"); mimeTypeMapping.setSetMethodName("setMimeType"); mimeTypeMapping.setXPath(getPrimaryNamespaceXPath() + "mime-type/text()"); descriptor.addMapping(mimeTypeMapping); XMLDirectMapping shouldInlineMapping = new XMLDirectMapping(); shouldInlineMapping.setAttributeName("shouldInlineBinaryData"); shouldInlineMapping.setXPath(getPrimaryNamespaceXPath() + "should-inline-data"); descriptor.addMapping(shouldInlineMapping); return descriptor; } public ClassDescriptor buildXMLBinaryDataCollectionMappingDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(XMLBinaryDataCollectionMapping.class); descriptor.getInheritancePolicy().setParentClass(XMLCompositeDirectCollectionMapping.class); XMLDirectMapping swaRefMapping = new XMLDirectMapping(); swaRefMapping.setAttributeName("isSwaRef"); swaRefMapping.setXPath(getPrimaryNamespaceXPath() + "is-swa-ref/text()"); descriptor.addMapping(swaRefMapping); XMLDirectMapping mimeTypeMapping = new XMLDirectMapping(); mimeTypeMapping.setAttributeName("mimeTypePolicy"); mimeTypeMapping.setGetMethodName("getMimeType"); mimeTypeMapping.setSetMethodName("setMimeType"); mimeTypeMapping.setXPath(getPrimaryNamespaceXPath() + "mime-type/text()"); descriptor.addMapping(mimeTypeMapping); XMLDirectMapping shouldInlineMapping = new XMLDirectMapping(); shouldInlineMapping.setAttributeName("shouldInlineBinaryData"); shouldInlineMapping.setXPath(getPrimaryNamespaceXPath() + "should-inline-data"); descriptor.addMapping(shouldInlineMapping); return descriptor; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy