blob: 3c1719e1fb11bb4b7eb872078d4ddfcf45b2faa5 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 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.jaxb.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.core.utility.jdt.Member;
import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlTransientAnnotation;
import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlTransientAnnotation;
import org.eclipse.jpt.jaxb.core.resource.java.Annotation;
import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember;
import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation;
/**
* javax.xml.bind.annotation.XmlTransient
*/
public final class XmlTransientAnnotationDefinition
implements AnnotationDefinition
{
// singleton
private static final AnnotationDefinition INSTANCE = new XmlTransientAnnotationDefinition();
/**
* Return the singleton.
*/
public static AnnotationDefinition instance() {
return INSTANCE;
}
/**
* Ensure single instance.
*/
private XmlTransientAnnotationDefinition() {
super();
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
return new SourceXmlTransientAnnotation((JavaResourceMember) parent, (Member) annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
throw new UnsupportedOperationException();
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
return new BinaryXmlTransientAnnotation((JavaResourceMember) parent, jdtAnnotation);
}
public String getAnnotationName() {
return XmlTransientAnnotation.ANNOTATION_NAME;
}
}