blob: 1e7e7b36b07a2838716bf900f9514c02c1ddbeb0 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 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.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.internal.jdtutility.Attribute;
import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
import org.eclipse.jpt.core.internal.jdtutility.Member;
import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.core.resource.java.Transient;
public class TransientImpl extends AbstractAnnotationResource<Attribute> implements Transient
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
protected TransientImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
}
public void initialize(CompilationUnit astRoot) {
//nothing to initialize
}
public String getAnnotationName() {
return ANNOTATION_NAME;
}
public void updateFromJava(CompilationUnit astRoot) {
//no annotation members
}
public static class TransientAnnotationDefinition implements AnnotationDefinition
{
// singleton
private static final TransientAnnotationDefinition INSTANCE = new TransientAnnotationDefinition();
/**
* Return the singleton.
*/
public static TransientAnnotationDefinition instance() {
return INSTANCE;
}
/**
* Ensure non-instantiability.
*/
private TransientAnnotationDefinition() {
super();
}
public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
return new TransientImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
}
public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
return null;
}
public String getAnnotationName() {
return ANNOTATION_NAME;
}
}
}