blob: a675fbecce23f25de25e7758af0b6b0857c743e8 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2011 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.jpa.core.internal.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.resource.java.binary.BinaryAttributeOverrideAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverrideAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.AttributeOverride
*/
public final class AttributeOverrideAnnotationDefinition
implements NestableAnnotationDefinition
{
// singleton
private static final NestableAnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition();
/**
* Return the singleton.
*/
public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
/**
* Ensure single instance.
*/
private AttributeOverrideAnnotationDefinition() {
super();
}
public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
return SourceAttributeOverrideAnnotation.buildSourceAttributeOverrideAnnotation(parent, annotatedElement, index);
}
public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
return new BinaryAttributeOverrideAnnotation(parent, jdtAnnotation);
}
public String getNestableAnnotationName() {
return JPA.ATTRIBUTE_OVERRIDE;
}
public String getContainerAnnotationName() {
return JPA.ATTRIBUTE_OVERRIDES;
}
public String getElementName() {
return JPA.ATTRIBUTE_OVERRIDES__VALUE;
}
}