blob: 5f38e45b255dbd6dd55fd75c688e64ab1fb8d12d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 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.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQueryAnnotation2_0;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQueryAnnotation2_0;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* <code>javax.persistence.NamedQuery</code>
*/
public class NamedQueryAnnotationDefinition2_0
implements NestableAnnotationDefinition
{
// singleton
private static final NestableAnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition2_0();
/**
* Return the singleton.
*/
public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
/**
* Ensure single instance.
*/
private NamedQueryAnnotationDefinition2_0() {
super();
}
public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
return SourceNamedQueryAnnotation2_0.buildSourceNamedQueryAnnotation(parent, annotatedElement, index);
}
public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
return new BinaryNamedQueryAnnotation2_0(parent, jdtAnnotation);
}
public String getNestableAnnotationName() {
return JPA.NAMED_QUERY;
}
public String getContainerAnnotationName() {
return JPA.NAMED_QUERIES;
}
public String getElementName() {
return JPA.NAMED_QUERIES__VALUE;
}
}