From 8f1f9c356e97be6e734b2fa12e6eb59994e91db9 Mon Sep 17 00:00:00 2001 From: pfullbright Date: Tue, 4 Aug 2009 15:05:13 +0000 Subject: model framework changes necessary to support derived id's --- .../NullSpecifiedJavaAttributeMappingProvider.java | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java') diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java new file mode 100644 index 0000000000..a36b941c17 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/NullSpecifiedJavaAttributeMappingProvider.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 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.java; + +import org.eclipse.jpt.core.JpaFactory; +import org.eclipse.jpt.core.MappingKeys; + +/** + * This mapping provider implementation is used to describe the specified mapping for + * a java attribute when no other mapping applies. + */ +public class NullSpecifiedJavaAttributeMappingProvider + implements JavaAttributeMappingProvider +{ + // singleton + private static final NullSpecifiedJavaAttributeMappingProvider INSTANCE = + new NullSpecifiedJavaAttributeMappingProvider(); + + + /** + * Return the singleton. + */ + public static JavaAttributeMappingProvider instance() { + return INSTANCE; + } + + + /** + * Enforce singleton usage + */ + private NullSpecifiedJavaAttributeMappingProvider() { + super(); + } + + + public String getKey() { + return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY; + } + + public String getAnnotationName() { + return null; + } + + /** + * There is no specified mapping in this case, attributes should revert to the default + */ + public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { + return null; + } + + /** + * Obviously false + */ + public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { + return false; + } + + /** + * This is typically the final test, so it should always apply + */ + public boolean specifiedApplies(JavaPersistentAttribute persistentAttribute) { + return true; + } +} -- cgit v1.2.3