blob: 8a6c833100e33b1ddf9d9255a546be70d76f51ce [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2009 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.core.context.orm;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
public class NullOrmAttributeMappingDefinition
implements OrmAttributeMappingDefinition
{
// singleton
private static final OrmAttributeMappingDefinition INSTANCE =
new NullOrmAttributeMappingDefinition();
/**
* Return the singleton.
*/
public static OrmAttributeMappingDefinition instance() {
return INSTANCE;
}
/**
* Enforce singleton usage
*/
private NullOrmAttributeMappingDefinition() {
super();
}
public String getKey() {
return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
}
public XmlAttributeMapping buildResourceMapping(EFactory factory) {
throw new UnsupportedOperationException();
}
public OrmAttributeMapping buildContextMapping(OrmPersistentAttribute parent, XmlAttributeMapping resourceMapping, OrmXmlContextNodeFactory factory) {
return factory.buildOrmNullAttributeMapping(parent, (XmlNullAttributeMapping) resourceMapping);
}
public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, OrmXmlContextNodeFactory factory) {
return factory.buildVirtualXmlNullAttributeMapping(ormTypeMapping, javaAttributeMapping);
}
}