| /******************************************************************************* |
| * Copyright (c) 2011, 2013 Oracle. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License 2.0, which accompanies this distribution |
| * and is available at https://www.eclipse.org/legal/epl-2.0/. |
| * |
| * Contributors: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; |
| |
| import org.eclipse.jpt.common.utility.internal.iterable.IterableTools; |
| import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; |
| import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition; |
| import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CacheAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ChangeTrackingAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ConverterAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.CustomizerAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ExistenceCheckingAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.ReadOnlyAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.StructConverterAnnotation; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.TypeConverterAnnotation; |
| |
| public class EclipseLinkJavaEntityDefinition |
| extends JavaTypeMappingDefinitionWrapper |
| { |
| private static final JavaTypeMappingDefinition DELEGATE = JavaEntityDefinition.instance(); |
| |
| // singleton |
| private static final JavaTypeMappingDefinition INSTANCE = new EclipseLinkJavaEntityDefinition(); |
| |
| /** |
| * Return the singleton. |
| */ |
| public static JavaTypeMappingDefinition instance() { |
| return INSTANCE; |
| } |
| |
| |
| /** |
| * Enforce singleton usage |
| */ |
| private EclipseLinkJavaEntityDefinition() { |
| super(); |
| } |
| |
| @Override |
| protected JavaTypeMappingDefinition getDelegate() { |
| return DELEGATE; |
| } |
| |
| @Override |
| public Iterable<String> getSupportingAnnotationNames() { |
| return COMBINED_SUPPORTING_ANNOTATION_NAMES; |
| } |
| |
| private static final String[] ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { |
| CacheAnnotation.ANNOTATION_NAME, |
| ChangeTrackingAnnotation.ANNOTATION_NAME, |
| ConverterAnnotation.ANNOTATION_NAME, |
| CustomizerAnnotation.ANNOTATION_NAME, |
| ExistenceCheckingAnnotation.ANNOTATION_NAME, |
| ObjectTypeConverterAnnotation.ANNOTATION_NAME, |
| ReadOnlyAnnotation.ANNOTATION_NAME, |
| StructConverterAnnotation.ANNOTATION_NAME, |
| TypeConverterAnnotation.ANNOTATION_NAME, |
| }; |
| // 'public' because EclipseLink MappedSuperclass also supports these annotations |
| public static final Iterable<String> ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES = IterableTools.iterable(ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES_ARRAY); |
| |
| @SuppressWarnings("unchecked") |
| private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = IterableTools.concatenate( |
| DELEGATE.getSupportingAnnotationNames(), |
| ECLIPSE_LINK_SUPPORTING_ANNOTATION_NAMES |
| ); |
| } |