### Eclipse Workspace Patch 1.0
#P org.eclipse.jpt.eclipselink.core
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionImpl.java 11 Nov 2008 15:47:18 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.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.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation;
-
-
-public class BasicCollectionImpl extends AbstractResourceAnnotation implements BasicCollectionAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- protected BasicCollectionImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void update(CompilationUnit astRoot) {
- }
-
- public static class BasicCollectionAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final BasicCollectionAnnotationDefinition INSTANCE = new BasicCollectionAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static BasicCollectionAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private BasicCollectionAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new BasicCollectionImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchImpl.java 23 Oct 2008 19:04:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.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.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType;
-
-
-public class JoinFetchImpl extends AbstractResourceAnnotation implements JoinFetchAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter valueAdapter;
-
- private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
-
-
- private JoinFetchType value;
-
- protected JoinFetchImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter(attribute, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** CacheAnnotation implementation ****************
-
- public JoinFetchType getValue() {
- return this.value;
- }
-
- public void setValue(JoinFetchType newValue) {
- if (attributeValueHasNotChanged(this.value, newValue)) {
- return;
- }
- JoinFetchType oldValue = this.value;
- this.value = newValue;
- this.valueAdapter.setValue(JoinFetchType.toJavaAnnotationValue(newValue));
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.value(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.value(astRoot));
- }
-
- protected JoinFetchType value(CompilationUnit astRoot) {
- return JoinFetchType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter buildValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.JOIN_FETCH_VALUE, false);
- }
-
- public static class JoinFetchAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final JoinFetchAnnotationDefinition INSTANCE = new JoinFetchAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static JoinFetchAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JoinFetchAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new JoinFetchImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new NullJoinFetchAnnotation((JavaResourcePersistentAttribute) parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumn.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumn.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumn.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumn.java 5 Sep 2008 15:27:21 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.NullBaseColumn;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation;
-
-
-public class NullWriteTransformerColumn extends NullBaseColumn implements ColumnAnnotation, Annotation
-{
- public NullWriteTransformerColumn(WriteTransformerAnnotation parent) {
- super(parent);
- }
-
- @Override
- public WriteTransformerAnnotation getParent() {
- return (WriteTransformerAnnotation) super.getParent();
- }
-
- public String getAnnotationName() {
- return ColumnAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected ColumnAnnotation createResourceColumn() {
- return getParent().addColumn();
- }
-
- public Integer getLength() {
- return null;
- }
-
- public void setLength(Integer length) {
- if (length != null) {
- createResourceColumn().setLength(length);
- }
- }
-
- public Integer getScale() {
- return null;
- }
-
- public void setScale(Integer scale) {
- if (scale != null) {
- createResourceColumn().setScale(scale);
- }
- }
-
- public Integer getPrecision() {
- return null;
- }
-
- public void setPrecision(Integer precision) {
- if (precision != null) {
- createResourceColumn().setPrecision(precision);
- }
- }
-
- public TextRange getScaleTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getLengthTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyImpl.java 23 Oct 2008 19:04:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation;
-
-
-public class ReadOnlyImpl extends AbstractResourceAnnotation implements ReadOnlyAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- protected ReadOnlyImpl(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- //nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- //nothing to update
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- public static class ReadOnlyAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final ReadOnlyAnnotationDefinition INSTANCE = new ReadOnlyAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private ReadOnlyAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new ReadOnlyImpl(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformation.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformation.java 2 Sep 2008 17:55:14 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation;
-
-
-public class NullTransformation extends AbstractJavaResourceNode implements BasicAnnotation, Annotation
-{
- protected NullTransformation(JavaResourcePersistentMember parent) {
- super(parent);
- }
-
- public void initialize(CompilationUnit astRoot) {
- //null, nothing to initialize
- }
-
- public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) {
- return null;
- }
-
- public void newAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public String getAnnotationName() {
- return TransformationAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public JavaResourcePersistentMember getParent() {
- return (JavaResourcePersistentMember) super.getParent();
- }
-
- protected TransformationAnnotation createTransformationResource() {
- getParent().setMappingAnnotation(getAnnotationName());
- return (TransformationAnnotation) getParent().getMappingAnnotation();
- }
-
- public FetchType getFetch() {
- return null;
- }
-
- public void setFetch(FetchType fetch) {
- if (fetch != null) {
- createTransformationResource().setFetch(fetch);
- }
- }
-
- public Boolean getOptional() {
- return null;
- }
-
- public void setOptional(Boolean optional) {
- if (optional != null) {
- createTransformationResource().setOptional(optional);
- }
- }
-
- public void update(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterImpl.java 23 Oct 2008 19:04:13 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,392 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.ContainerAnnotationTools;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.TypeStringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.NestableConversionValue;
-import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-
-public class ObjectTypeConverterImpl extends AbstractResourceAnnotation implements ObjectTypeConverterAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter nameAdapter;
- private final AnnotationElementAdapter dataTypeAdapter;
- private final AnnotationElementAdapter objectTypeAdapter;
- private final AnnotationElementAdapter defaultObjectValueAdapter;
-
- private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = buildNameAdapter();
- private static final DeclarationAnnotationElementAdapter DATA_TYPE_ADAPTER = buildDataTypeAdapter();
- private static final DeclarationAnnotationElementAdapter OBJECT_TYPE_ADAPTER = buildObjectTypeAdapter();
- private static final DeclarationAnnotationElementAdapter DEFAULT_OBJECT_VALUE_ADAPTER = buildDefaultObjectValueAdapter();
-
-
- private String name;
- private String dataType;
- private String objectType;
- private String defaultObjectValue;
-
- protected final List conversionValues;
- private final ConversionValuesContainerAnnotation conversionValuesContainerAnnotation;
-
- protected ObjectTypeConverterImpl(JavaResourcePersistentMember parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter(member, NAME_ADAPTER);
- this.dataTypeAdapter = new ShortCircuitAnnotationElementAdapter(member, DATA_TYPE_ADAPTER);
- this.objectTypeAdapter = new ShortCircuitAnnotationElementAdapter(member, OBJECT_TYPE_ADAPTER);
- this.defaultObjectValueAdapter = new ShortCircuitAnnotationElementAdapter(member, DEFAULT_OBJECT_VALUE_ADAPTER);
- this.conversionValues = new ArrayList();
- this.conversionValuesContainerAnnotation = new ConversionValuesContainerAnnotation();
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.name(astRoot);
- this.dataType = this.dataType(astRoot);
- this.objectType = this.objectType(astRoot);
- this.defaultObjectValue = this.defaultObjectValue(astRoot);
- ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.conversionValuesContainerAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** ObjectTypeConverter implementation ****************
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- if (attributeValueHasNotChanged(this.name, newName)) {
- return;
- }
- String oldName = this.name;
- this.name = newName;
- this.nameAdapter.setValue(newName);
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- public String getDataType() {
- return this.dataType;
- }
-
- public void setDataType(String newDataType) {
- if (attributeValueHasNotChanged(this.dataType, newDataType)) {
- return;
- }
- String oldDataType = this.dataType;
- this.dataType = newDataType;
- this.dataTypeAdapter.setValue(newDataType);
- firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType);
- }
-
- public String getObjectType() {
- return this.objectType;
- }
-
- public void setObjectType(String newObjectType) {
- if (attributeValueHasNotChanged(this.objectType, newObjectType)) {
- return;
- }
- String oldObjectType = this.objectType;
- this.objectType = newObjectType;
- this.objectTypeAdapter.setValue(newObjectType);
- firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType);
- }
-
- public String getDefaultObjectValue() {
- return this.defaultObjectValue;
- }
-
- public void setDefaultObjectValue(String newDefaultObjectValue) {
- if (attributeValueHasNotChanged(this.defaultObjectValue, newDefaultObjectValue)) {
- return;
- }
- String oldDefaultObjectValue = this.defaultObjectValue;
- this.defaultObjectValue = newDefaultObjectValue;
- this.defaultObjectValueAdapter.setValue(newDefaultObjectValue);
- firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue);
- }
-
- public ListIterator conversionValues() {
- return new CloneListIterator(this.conversionValues);
- }
-
- public int conversionValuesSize() {
- return this.conversionValues.size();
- }
-
- public NestableConversionValue conversionValueAt(int index) {
- return this.conversionValues.get(index);
- }
-
- public int indexOfConversionValue(ConversionValueAnnotation conversionValue) {
- return this.conversionValues.indexOf(conversionValue);
- }
-
- public NestableConversionValue addConversionValue(int index) {
- NestableConversionValue conversionValue = (NestableConversionValue) ContainerAnnotationTools.addNestedAnnotation(index, this.conversionValuesContainerAnnotation);
- fireItemAdded(AssociationOverrideAnnotation.JOIN_COLUMNS_LIST, index, conversionValue);
- return conversionValue;
- }
-
- protected void addConversionValue(int index, NestableConversionValue conversionValue) {
- addItemToList(index, conversionValue, this.conversionValues, AssociationOverrideAnnotation.JOIN_COLUMNS_LIST);
- }
-
- public void removeConversionValue(int index) {
- NestableConversionValue conversionValue = this.conversionValues.get(index);
- removeConversionValue(conversionValue);
- conversionValue.removeAnnotation();
- ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.conversionValuesContainerAnnotation);
- }
-
- protected void removeConversionValue(NestableConversionValue conversionValue) {
- removeItemFromList(conversionValue, this.conversionValues, AssociationOverrideAnnotation.JOIN_COLUMNS_LIST);
- }
-
- public void moveConversionValue(int targetIndex, int sourceIndex) {
- moveConversionValueInternal(targetIndex, sourceIndex);
- ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.conversionValuesContainerAnnotation);
- fireItemMoved(AssociationOverrideAnnotation.JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
- }
-
- protected void moveConversionValueInternal(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.conversionValues, targetIndex, sourceIndex);
- }
-
- protected NestableConversionValue createConversionValue(int index) {
- return ConversionValueImpl.createConversionValue(this, getMember(), getDeclarationAnnotationAdapter(), index);
- }
-
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(NAME_ADAPTER, astRoot);
- }
-
- public TextRange getDataTypeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(DATA_TYPE_ADAPTER, astRoot);
- }
-
- public TextRange getObjectTypeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(OBJECT_TYPE_ADAPTER, astRoot);
- }
-
- public TextRange getDefaultObjectValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(DEFAULT_OBJECT_VALUE_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.name(astRoot));
- this.setDataType(this.dataType(astRoot));
- this.setObjectType(this.objectType(astRoot));
- this.setDefaultObjectValue(this.defaultObjectValue(astRoot));
- ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.conversionValuesContainerAnnotation);
- }
-
- protected String name(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- protected String dataType(CompilationUnit astRoot) {
- return this.dataTypeAdapter.getValue(astRoot);
- }
-
- protected String objectType(CompilationUnit astRoot) {
- return this.objectTypeAdapter.getValue(astRoot);
- }
-
- protected String defaultObjectValue(CompilationUnit astRoot) {
- return this.defaultObjectValueAdapter.getValue(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildNameAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__NAME, false, StringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildDataTypeAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DATE_TYPE, false, TypeStringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildObjectTypeAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__OBJECT_TYPE, false, TypeStringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildDefaultObjectValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE, false, StringExpressionConverter.instance());
- }
-
- public static class ObjectTypeConverterAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final ObjectTypeConverterAnnotationDefinition INSTANCE = new ObjectTypeConverterAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static ObjectTypeConverterAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private ObjectTypeConverterAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new ObjectTypeConverterImpl(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
- private class ConversionValuesContainerAnnotation extends AbstractJavaResourceNode
- implements ContainerAnnotation
- {
- public ConversionValuesContainerAnnotation() {
- super(ObjectTypeConverterImpl.this);
- }
-
- public void initialize(CompilationUnit astRoot) {
- //nothing to initialize
- }
-
- public NestableConversionValue addInternal(int index) {
- NestableConversionValue conversionValue = ObjectTypeConverterImpl.this.createConversionValue(index);
- ObjectTypeConverterImpl.this.conversionValues.add(index, conversionValue);
- return conversionValue;
- }
-
- public NestableConversionValue add(int index) {
- NestableConversionValue conversionValue = ObjectTypeConverterImpl.this.createConversionValue(index);
- ObjectTypeConverterImpl.this.addConversionValue(index, conversionValue);
- return conversionValue;
- }
-
- public int indexOf(NestableConversionValue conversionValue) {
- return ObjectTypeConverterImpl.this.indexOfConversionValue(conversionValue);
- }
-
- public void move(int targetIndex, int sourceIndex) {
- ObjectTypeConverterImpl.this.moveConversionValue(targetIndex, sourceIndex);
- }
-
- public void moveInternal(int targetIndex, int sourceIndex) {
- ObjectTypeConverterImpl.this.moveConversionValueInternal(targetIndex, sourceIndex);
- }
-
- public NestableConversionValue nestedAnnotationAt(int index) {
- return ObjectTypeConverterImpl.this.conversionValueAt(index);
- }
-
- public ListIterator nestedAnnotations() {
- return new CloneListIterator(ObjectTypeConverterImpl.this.conversionValues);
- }
-
- public int nestedAnnotationsSize() {
- return conversionValuesSize();
- }
-
- public void remove(int index) {
- this.remove(nestedAnnotationAt(index));
- }
-
- public void remove(NestableConversionValue conversionValue) {
- ObjectTypeConverterImpl.this.removeConversionValue(conversionValue);
- }
-
- public String getAnnotationName() {
- return ObjectTypeConverterImpl.this.getAnnotationName();
- }
-
- public String getNestableAnnotationName() {
- return EclipseLinkJPA.CONVERSION_VALUE;
- }
-
- public NestableConversionValue nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
- for (NestableConversionValue conversionValue : CollectionTools.iterable(nestedAnnotations())) {
- if (jdtAnnotation == conversionValue.getJdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
- return conversionValue;
- }
- }
- return null;
- }
-
- public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) {
- return ObjectTypeConverterImpl.this.getJdtAnnotation(astRoot);
- }
-
- public void newAnnotation() {
- ObjectTypeConverterImpl.this.newAnnotation();
- }
-
- public void removeAnnotation() {
- ObjectTypeConverterImpl.this.removeAnnotation();
- }
-
- public void update(CompilationUnit astRoot) {
- ObjectTypeConverterImpl.this.update(astRoot);
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return ObjectTypeConverterImpl.this.getTextRange(astRoot);
- }
-
- public String getElementName() {
- return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getAnnotationName());
- }
-
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationImpl.java 23 Oct 2008 19:04:13 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation;
-
-
-public class TransformationImpl extends AbstractResourceAnnotation implements TransformationAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter optionalAdapter;
-
- private final AnnotationElementAdapter fetchAdapter;
-
- private static final DeclarationAnnotationElementAdapter OPTIONAL_ADAPTER = buildOptionalAdapter();
-
- private static final DeclarationAnnotationElementAdapter FETCH_ADAPTER = buildFetchAdapter();
-
- private Boolean optional;
-
- private FetchType fetch;
-
- protected TransformationImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.optionalAdapter = new ShortCircuitAnnotationElementAdapter(attribute, OPTIONAL_ADAPTER);
- this.fetchAdapter = new ShortCircuitAnnotationElementAdapter(attribute, FETCH_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.optional = this.optional(astRoot);
- this.fetch = this.fetch(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** Transformation implementation ****************
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean newOptional) {
- if (attributeValueHasNotChanged(this.optional, newOptional)) {
- return;
- }
- Boolean oldOptional = this.optional;
- this.optional = newOptional;
- this.optionalAdapter.setValue(newOptional);
- firePropertyChanged(OPTIONAL_PROPERTY, oldOptional, newOptional);
- }
-
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType newFetch) {
- if (attributeValueHasNotChanged(this.fetch, newFetch)) {
- return;
- }
- FetchType oldFetch = this.fetch;
- this.fetch = newFetch;
- this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(newFetch));
- firePropertyChanged(FETCH_PROPERTY, oldFetch, newFetch);
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(FETCH_ADAPTER, astRoot);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setOptional(this.optional(astRoot));
- this.setFetch(this.fetch(astRoot));
- }
-
- protected FetchType fetch(CompilationUnit astRoot) {
- return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
- }
-
- protected Boolean optional(CompilationUnit astRoot) {
- return this.optionalAdapter.getValue(astRoot);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildOptionalAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TRANSFORMATION__OPTIONAL, false, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildFetchAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TRANSFORMATION__FETCH, false);
- }
-
- public static class TransformationAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final TransformationAnnotationDefinition INSTANCE = new TransformationAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static TransformationAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private TransformationAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new TransformationImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new NullTransformation(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingImpl.java 23 Oct 2008 19:04:13 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType;
-
-
-public class ExistenceCheckingImpl extends AbstractResourceAnnotation implements ExistenceCheckingAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter valueAdapter;
-
- private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
-
-
- private ExistenceType value;
-
- protected ExistenceCheckingImpl(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter(type, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** CacheAnnotation implementation ****************
-
- public ExistenceType getValue() {
- return this.value;
- }
-
- public void setValue(ExistenceType newValue) {
- if (attributeValueHasNotChanged(this.value, newValue)) {
- return;
- }
- ExistenceType oldValue = this.value;
- this.value = newValue;
- this.valueAdapter.setValue(ExistenceType.toJavaAnnotationValue(newValue));
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.value(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.value(astRoot));
- }
-
- protected ExistenceType value(CompilationUnit astRoot) {
- return ExistenceType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter buildValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.EXISTENCE_CHECKING__VALUE, false);
- }
-
- public static class ExistenceCheckingAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final ExistenceCheckingAnnotationDefinition INSTANCE = new ExistenceCheckingAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static ExistenceCheckingAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private ExistenceCheckingAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new ExistenceCheckingImpl((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerImpl.java 23 Oct 2008 19:04:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.ColumnImpl;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation;
-
-
-public class WriteTransformerImpl extends AbstractResourceAnnotation implements WriteTransformerAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter transformerClassAdapter;
- private final AnnotationElementAdapter methodAdapter;
- private final MemberAnnotationAdapter columnAdapter;
-
- private static final DeclarationAnnotationElementAdapter TRANSFORMER_CLASS_ADAPTER = buildTransformerClassAdapter();
- private static final DeclarationAnnotationElementAdapter METHOD_ADAPTER = buildMethodAdapter();
-
- private String transformerClass;
- private String method;
- private ColumnImpl column;
-
-
- protected WriteTransformerImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.transformerClassAdapter = new ShortCircuitAnnotationElementAdapter(attribute, TRANSFORMER_CLASS_ADAPTER);
- this.methodAdapter = new ShortCircuitAnnotationElementAdapter(attribute, METHOD_ADAPTER);
- this.columnAdapter = new MemberAnnotationAdapter(getMember(), buildColumnAnnotationAdapter(getDeclarationAnnotationAdapter()));
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.transformerClass = this.transformerClass(astRoot);
- this.method = this.method(astRoot);
- if (this.columnAdapter.getAnnotation(astRoot) != null) {
- this.column = createColumn(this, getMember(), getDeclarationAnnotationAdapter());
- this.column.initialize(astRoot);
- }
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** WriteTransformer implementation ****************
- public String getTransformerClass() {
- return this.transformerClass;
- }
-
- public void setTransformerClass(String newTransformerClass) {
- if (attributeValueHasNotChanged(this.transformerClass, newTransformerClass)) {
- return;
- }
- String oldTransformerClass = this.transformerClass;
- this.transformerClass = newTransformerClass;
- this.transformerClassAdapter.setValue(newTransformerClass);
- firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, oldTransformerClass, newTransformerClass);
- }
-
- public String getMethod() {
- return this.method;
- }
-
- public void setMethod(String newMethod) {
- if (attributeValueHasNotChanged(this.method, newMethod)) {
- return;
- }
- String oldMethod = this.method;
- this.method = newMethod;
- this.methodAdapter.setValue(newMethod);
- firePropertyChanged(METHOD_PROPERTY, oldMethod, newMethod);
- }
-
- public ColumnAnnotation getNonNullColumn() {
- return (getColumn() != null) ? getColumn() : new NullWriteTransformerColumn(this);
- }
-
- public ColumnAnnotation getColumn() {
- return this.column;
- }
-
- public ColumnAnnotation addColumn() {
- ColumnImpl column = createColumn(this, getMember(), getDeclarationAnnotationAdapter());
- column.newAnnotation();
- setColumn(column);
- return column;
- }
-
- public void removeColumn() {
- this.column.removeAnnotation();
- setColumn(null);
- }
-
- protected void setColumn(ColumnImpl newColumn) {
- ColumnImpl oldColumn = this.column;
- this.column = newColumn;
- firePropertyChanged(WriteTransformerAnnotation.COLUMN_PROPERTY, oldColumn, newColumn);
- }
-
-
- public TextRange getTransformerClassTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(TRANSFORMER_CLASS_ADAPTER, astRoot);
- }
-
- public TextRange getMethodTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(METHOD_ADAPTER, astRoot);
- }
-
- public TextRange getColumnTextRange(CompilationUnit astRoot) {
- if (this.column != null) {
- return this.column.getTextRange(astRoot);
- }
- return getTextRange(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setTransformerClass(this.transformerClass(astRoot));
- this.setMethod(this.method(astRoot));
- if (this.columnAdapter.getAnnotation(astRoot) == null) {
- this.setColumn(null);
- }
- else {
- if (getColumn() != null) {
- getColumn().update(astRoot);
- }
- else {
- ColumnImpl column = createColumn(this, getMember(), getDeclarationAnnotationAdapter());
- column.initialize(astRoot);
- this.setColumn(column);
- }
- }
- }
-
- protected String transformerClass(CompilationUnit astRoot) {
- return this.transformerClassAdapter.getValue(astRoot);
- }
-
- protected String method(CompilationUnit astRoot) {
- return this.methodAdapter.getValue(astRoot);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildTransformerClassAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.WRITE_TRANSFORMER__TRANSFORMER_CLASS, false, SimpleTypeStringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildMethodAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.WRITE_TRANSFORMER__METHOD, false);
- }
-
- private static DeclarationAnnotationAdapter buildColumnAnnotationAdapter(DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) {
- return new NestedDeclarationAnnotationAdapter(writeTransformerAnnotationAdapter, EclipseLinkJPA.WRITE_TRANSFORMER__COLUMN, JPA.COLUMN, false);
- }
-
- private static ColumnImpl createColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) {
- return new ColumnImpl(parent, member, buildColumnAnnotationAdapter(writeTransformerAnnotationAdapter));
- }
-
- public static class WriteTransformerAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final WriteTransformerAnnotationDefinition INSTANCE = new WriteTransformerAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static WriteTransformerAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private WriteTransformerAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new WriteTransformerImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneImpl.java 6 Jan 2009 22:48:26 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.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.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.VariableOneToOneAnnotation;
-
-
-public class VariableOneToOneImpl extends AbstractResourceAnnotation implements VariableOneToOneAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- protected VariableOneToOneImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void update(CompilationUnit astRoot) {
- }
-
- public static class VariableOneToOneAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final VariableOneToOneAnnotationDefinition INSTANCE = new VariableOneToOneAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static VariableOneToOneAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private VariableOneToOneAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new VariableOneToOneImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableImpl.java 23 Oct 2008 19:04:13 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.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.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
-
-
-public class MutableImpl extends AbstractResourceAnnotation implements MutableAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter valueAdapter;
-
- private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
-
-
- private Boolean value;
-
- protected MutableImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter(attribute, VALUE_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.value(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** Mutable implementation ****************
- public Boolean getValue() {
- return this.value;
- }
-
- public void setValue(Boolean newValue) {
- if (attributeValueHasNotChanged(this.value, newValue)) {
- return;
- }
- Boolean oldValue = this.value;
- this.value = newValue;
- this.valueAdapter.setValue(newValue);
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.value(astRoot));
- }
-
- protected Boolean value(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.MUTABLE__VALUE, false, BooleanExpressionConverter.instance());
- }
-
-
- public static class MutableAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final MutableAnnotationDefinition INSTANCE = new MutableAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static MutableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private MutableAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new MutableImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheImpl.java 23 Oct 2008 19:04:13 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,423 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType;
-import org.eclipse.jpt.eclipselink.core.resource.java.CacheType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
-
-
-public class CacheImpl extends AbstractResourceAnnotation implements CacheAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter typeAdapter;
- private final AnnotationElementAdapter sizeAdapter;
- private final AnnotationElementAdapter sharedAdapter;
- private final AnnotationElementAdapter expiryAdapter;
- private final AnnotationElementAdapter alwaysRefreshAdapter;
- private final AnnotationElementAdapter refreshOnlyIfNewerAdapter;
- private final AnnotationElementAdapter disableHitsAdapter;
- private final AnnotationElementAdapter coordinationTypeAdapter;
- private final MemberAnnotationAdapter expiryTimeOfDayAdapter;
-
- private static final DeclarationAnnotationElementAdapter TYPE_ADAPTER = buildTypeAdapter();
- private static final DeclarationAnnotationElementAdapter SIZE_ADAPTER = buildSizeAdapter();
- private static final DeclarationAnnotationElementAdapter SHARED_ADAPTER = buildSharedAdapter();
- private static final DeclarationAnnotationElementAdapter EXPIRY_ADAPTER = buildExpiryAdapter();
- private static final DeclarationAnnotationElementAdapter ALWAYS_REFRESH_ADAPTER = buildAlwaysRefreshAdapter();
- private static final DeclarationAnnotationElementAdapter REFRESH_ONLY_IF_NEWER_ADAPTER = buildRefreshOnlyIfNewerAdapter();
- private static final DeclarationAnnotationElementAdapter DISABLE_HITS_ADAPTER = buildDisableHitsAdapter();
- private static final DeclarationAnnotationElementAdapter COORDINATION_TYPE_ADAPTER = buildCoordinationTypeAdapter();
- private static final NestedDeclarationAnnotationAdapter EXPIRY_TIME_OF_DAY_ADAPTER = buildExpiryTimeOfDayAnnotationAdapter();
-
-
- private CacheType type;
- private Integer size;
- private Boolean shared;
- private Integer expiry;
- private TimeOfDayAnnotation expiryTimeOfDay;
- private Boolean alwaysRefresh;
- private Boolean refreshOnlyIfNewer;
- private Boolean disableHits;
- private CacheCoordinationType coordinationType;
-
- protected CacheImpl(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.typeAdapter = new ShortCircuitAnnotationElementAdapter(type, TYPE_ADAPTER);
- this.sizeAdapter = new ShortCircuitAnnotationElementAdapter(type, SIZE_ADAPTER);
- this.sharedAdapter = new ShortCircuitAnnotationElementAdapter(type, SHARED_ADAPTER);
- this.expiryAdapter = new ShortCircuitAnnotationElementAdapter(type, EXPIRY_ADAPTER);
- this.alwaysRefreshAdapter = new ShortCircuitAnnotationElementAdapter(type, ALWAYS_REFRESH_ADAPTER);
- this.refreshOnlyIfNewerAdapter = new ShortCircuitAnnotationElementAdapter(type, REFRESH_ONLY_IF_NEWER_ADAPTER);
- this.disableHitsAdapter = new ShortCircuitAnnotationElementAdapter(type, DISABLE_HITS_ADAPTER);
- this.coordinationTypeAdapter = new ShortCircuitAnnotationElementAdapter(type, COORDINATION_TYPE_ADAPTER);
- this.expiryTimeOfDayAdapter = new MemberAnnotationAdapter(type, EXPIRY_TIME_OF_DAY_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** CacheAnnotation implementation ****************
-
- public CacheType getType() {
- return this.type;
- }
-
- public void setType(CacheType newType) {
- if (attributeValueHasNotChanged(this.type, newType)) {
- return;
- }
- CacheType oldType = this.type;
- this.type = newType;
- this.typeAdapter.setValue(CacheType.toJavaAnnotationValue(newType));
- firePropertyChanged(TYPE_PROPERTY, oldType, newType);
- }
-
- public Integer getSize() {
- return this.size;
- }
-
- public void setSize(Integer newSize) {
- if (attributeValueHasNotChanged(this.size, newSize)) {
- return;
- }
- Integer oldSize = this.size;
- this.size = newSize;
- this.sizeAdapter.setValue(newSize);
- firePropertyChanged(SIZE_PROPERTY, oldSize, newSize);
- }
-
- public Boolean getShared() {
- return this.shared;
- }
-
- public void setShared(Boolean newShared) {
- if (attributeValueHasNotChanged(this.shared, newShared)) {
- return;
- }
- Boolean oldShared = this.shared;
- this.shared = newShared;
- this.sharedAdapter.setValue(newShared);
- firePropertyChanged(SHARED_PROPERTY, oldShared, newShared);
- }
-
- public Integer getExpiry() {
- return this.expiry;
- }
-
- public void setExpiry(Integer newExpiry) {
- if (attributeValueHasNotChanged(this.expiry, newExpiry)) {
- return;
- }
- Integer oldExpiry = this.expiry;
- this.expiry = newExpiry;
- this.expiryAdapter.setValue(newExpiry);
- firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry);
- }
-
- public TimeOfDayAnnotation getExpiryTimeOfDay() {
- return this.expiryTimeOfDay;
- }
-
- public TimeOfDayAnnotation addExpiryTimeOfDay() {
- if (this.expiryTimeOfDay != null) {
- throw new IllegalStateException("ExpiryTimeOfDay element already exists"); //$NON-NLS-1$
- }
- this.expiryTimeOfDay = createTimeOfDayAnnotation();
- this.expiryTimeOfDayAdapter.newMarkerAnnotation();
- firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, null, this.expiryTimeOfDay);
- return this.expiryTimeOfDay;
- }
-
- public void removeExpiryTimeOfDay() {
- if (this.expiryTimeOfDay == null) {
- throw new IllegalStateException("No expiryTimeOfDay element exists"); //$NON-NLS-1$
- }
- this.expiryTimeOfDay = null;
- this.expiryTimeOfDayAdapter.removeAnnotation();
- firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, this.expiryTimeOfDay, null);
- }
-
- protected void setExpiryTimeOfDay(TimeOfDayAnnotation newExpiryTimeOfDay) {
- TimeOfDayAnnotation oldExpiryTimeOfDay = this.expiryTimeOfDay;
- this.expiryTimeOfDay = newExpiryTimeOfDay;
- firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, newExpiryTimeOfDay);
- }
-
- public Boolean getAlwaysRefresh() {
- return this.alwaysRefresh;
- }
-
- public void setAlwaysRefresh(Boolean newAlwaysRefresh) {
- if (attributeValueHasNotChanged(this.alwaysRefresh, newAlwaysRefresh)) {
- return;
- }
- Boolean oldAlwaysRefresh = this.alwaysRefresh;
- this.alwaysRefresh = newAlwaysRefresh;
- this.alwaysRefreshAdapter.setValue(newAlwaysRefresh);
- firePropertyChanged(ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newAlwaysRefresh);
- }
-
- public Boolean getRefreshOnlyIfNewer() {
- return this.refreshOnlyIfNewer;
- }
-
- public void setRefreshOnlyIfNewer(Boolean newRefreshOnlyIfNewer) {
- if (attributeValueHasNotChanged(this.refreshOnlyIfNewer, newRefreshOnlyIfNewer)) {
- return;
- }
- Boolean oldRefreshOnlyIfNewer = this.refreshOnlyIfNewer;
- this.refreshOnlyIfNewer = newRefreshOnlyIfNewer;
- this.refreshOnlyIfNewerAdapter.setValue(newRefreshOnlyIfNewer);
- firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newRefreshOnlyIfNewer);
- }
-
- public Boolean getDisableHits() {
- return this.disableHits;
- }
-
- public void setDisableHits(Boolean newDisableHits) {
- if (attributeValueHasNotChanged(this.disableHits, newDisableHits)) {
- return;
- }
- Boolean oldDisableHits = this.disableHits;
- this.disableHits = newDisableHits;
- this.disableHitsAdapter.setValue(newDisableHits);
- firePropertyChanged(DISABLE_HITS_PROPERTY, oldDisableHits, newDisableHits);
- }
-
- public CacheCoordinationType getCoordinationType() {
- return this.coordinationType;
- }
-
- public void setCoordinationType(CacheCoordinationType newCoordinationType) {
- if (attributeValueHasNotChanged(this.coordinationType, newCoordinationType)) {
- return;
- }
- CacheCoordinationType oldCoordinationType = this.coordinationType;
- this.coordinationType = newCoordinationType;
- this.coordinationTypeAdapter.setValue(CacheCoordinationType.toJavaAnnotationValue(newCoordinationType));
- firePropertyChanged(TYPE_PROPERTY, oldCoordinationType, newCoordinationType);
- }
-
- public TextRange getTypeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(TYPE_ADAPTER, astRoot);
- }
-
- public TextRange getSizeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(SIZE_ADAPTER, astRoot);
- }
-
- public TextRange getSharedTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(SHARED_ADAPTER, astRoot);
- }
-
- public TextRange getExpiryTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(EXPIRY_ADAPTER, astRoot);
- }
-
- public TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot) {
- return null;//TODO return this.getElementTextRange(EXPIRY_TIME_OF_DAY_ADAPTER, astRoot);
- }
-
- public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(ALWAYS_REFRESH_ADAPTER, astRoot);
- }
-
- public TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(REFRESH_ONLY_IF_NEWER_ADAPTER, astRoot);
- }
-
- public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(DISABLE_HITS_ADAPTER, astRoot);
- }
-
- public TextRange getCoordinationTypeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(COORDINATION_TYPE_ADAPTER, astRoot);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.type = this.type(astRoot);
- this.size = this.size(astRoot);
- this.shared = this.shared(astRoot);
- this.expiry = this.expiry(astRoot);
- this.initializeExpiryTimeOfDay(astRoot);
- this.alwaysRefresh = this.alwaysRefresh(astRoot);
- this.refreshOnlyIfNewer = this.refreshOnlyIfNewer(astRoot);
- this.disableHits = this.disableHits(astRoot);
- this.coordinationType = this.coordinationType(astRoot);
- }
-
- protected void initializeExpiryTimeOfDay(CompilationUnit astRoot) {
- if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) != null) {
- this.expiryTimeOfDay = createTimeOfDayAnnotation();
- this.expiryTimeOfDay.initialize(astRoot);
- }
- }
-
- public void update(CompilationUnit astRoot) {
- this.setType(this.type(astRoot));
- this.setSize(this.size(astRoot));
- this.setShared(this.shared(astRoot));
- this.setExpiry(this.expiry(astRoot));
- this.updateExpiryTimeOfDay(astRoot);
- this.setAlwaysRefresh(this.alwaysRefresh(astRoot));
- this.setRefreshOnlyIfNewer(this.refreshOnlyIfNewer(astRoot));
- this.setDisableHits(this.disableHits(astRoot));
- this.setCoordinationType(this.coordinationType(astRoot));
- }
-
- protected void updateExpiryTimeOfDay(CompilationUnit astRoot) {
- if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) == null) {
- this.setExpiryTimeOfDay(null);
- }
- else {
- if (getExpiryTimeOfDay() != null) {
- getExpiryTimeOfDay().update(astRoot);
- }
- else {
- TimeOfDayAnnotation expiryTimeOfDay = createTimeOfDayAnnotation();
- expiryTimeOfDay.initialize(astRoot);
- setExpiryTimeOfDay(expiryTimeOfDay);
- }
- }
- }
-
- protected CacheType type(CompilationUnit astRoot) {
- return CacheType.fromJavaAnnotationValue(this.typeAdapter.getValue(astRoot));
- }
-
- protected Integer size(CompilationUnit astRoot) {
- return this.sizeAdapter.getValue(astRoot);
- }
-
- protected Boolean shared(CompilationUnit astRoot) {
- return this.sharedAdapter.getValue(astRoot);
- }
-
- protected Integer expiry(CompilationUnit astRoot) {
- return this.expiryAdapter.getValue(astRoot);
- }
-
- protected TimeOfDayAnnotation createTimeOfDayAnnotation() {
- return new TimeOfDayImpl(this, getMember(), EXPIRY_TIME_OF_DAY_ADAPTER);
- }
-
- protected Boolean alwaysRefresh(CompilationUnit astRoot) {
- return this.alwaysRefreshAdapter.getValue(astRoot);
- }
-
- protected Boolean refreshOnlyIfNewer(CompilationUnit astRoot) {
- return this.refreshOnlyIfNewerAdapter.getValue(astRoot);
- }
-
- protected Boolean disableHits(CompilationUnit astRoot) {
- return this.disableHitsAdapter.getValue(astRoot);
- }
-
- protected CacheCoordinationType coordinationType(CompilationUnit astRoot) {
- return CacheCoordinationType.fromJavaAnnotationValue(this.coordinationTypeAdapter.getValue(astRoot));
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter buildTypeAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__TYPE);
- }
-
- private static DeclarationAnnotationElementAdapter buildSizeAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__SIZE, NumberIntegerExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildSharedAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__SHARED, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildExpiryAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__EXPIRY, NumberIntegerExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildAlwaysRefreshAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__ALWAYS_REFRESH, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildRefreshOnlyIfNewerAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__REFRESH_ONLY_IF_NEWER, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildDisableHitsAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__DISABLE_HITS, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildCoordinationTypeAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__COORDINATION_TYPE);
- }
-
- private static NestedDeclarationAnnotationAdapter buildExpiryTimeOfDayAnnotationAdapter() {
- return new NestedDeclarationAnnotationAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__EXPIRY_TIME_OF_DAY, EclipseLinkJPA.TIME_OF_DAY);
- }
-
- public static class CacheAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final CacheAnnotationDefinition INSTANCE = new CacheAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static CacheAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private CacheAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new CacheImpl((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new NullCacheAnnotation((JavaResourcePersistentType) parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TimeOfDayImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TimeOfDayImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TimeOfDayImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TimeOfDayImpl.java 27 Aug 2008 18:13:55 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
-
-
-public class TimeOfDayImpl extends AbstractResourceAnnotation implements TimeOfDayAnnotation
-{
- private final AnnotationElementAdapter hourAdapter;
- private final AnnotationElementAdapter minuteAdapter;
- private final AnnotationElementAdapter secondAdapter;
- private final AnnotationElementAdapter millisecondAdapter;
-
- private final DeclarationAnnotationElementAdapter hourDeclarationAdapter;
- private final DeclarationAnnotationElementAdapter minuteDeclarationAdapter;
- private final DeclarationAnnotationElementAdapter secondDeclarationAdapter;
- private final DeclarationAnnotationElementAdapter millisecondDeclarationAdapter;
-
-
- private Integer hour;
- private Integer minute;
- private Integer second;
- private Integer millisecond;
-
- protected TimeOfDayImpl(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa) {
- super(parent, type, daa);
- this.hourDeclarationAdapter = buildHourAdapter(daa);
- this.hourAdapter = new ShortCircuitAnnotationElementAdapter(type, this.hourDeclarationAdapter);
- this.minuteDeclarationAdapter = buildMinuteAdapter(daa);
- this.minuteAdapter = new ShortCircuitAnnotationElementAdapter(type, this.minuteDeclarationAdapter);
- this.secondDeclarationAdapter = buildSecondAdapter(daa);
- this.secondAdapter = new ShortCircuitAnnotationElementAdapter(type, this.secondDeclarationAdapter);
- this.millisecondDeclarationAdapter = buildMillisecondAdapter(daa);
- this.millisecondAdapter = new ShortCircuitAnnotationElementAdapter(type, this.millisecondDeclarationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** TimeOfDayAnnotation implementation ****************
-
- public Integer getHour() {
- return this.hour;
- }
-
- public void setHour(Integer newHour) {
- if (attributeValueHasNotChanged(this.hour, newHour)) {
- return;
- }
- Integer oldHour = this.hour;
- this.hour = newHour;
- this.hourAdapter.setValue(newHour);
- firePropertyChanged(HOUR_PROPERTY, oldHour, newHour);
- }
-
- public Integer getMinute() {
- return this.minute;
- }
-
- public void setMinute(Integer newMinute) {
- if (attributeValueHasNotChanged(this.minute, newMinute)) {
- return;
- }
- Integer oldMinute = this.minute;
- this.minute = newMinute;
- this.minuteAdapter.setValue(newMinute);
- firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute);
- }
-
- public Integer getSecond() {
- return this.second;
- }
-
- public void setSecond(Integer newSecond) {
- if (attributeValueHasNotChanged(this.second, newSecond)) {
- return;
- }
- Integer oldSecond = this.second;
- this.second = newSecond;
- this.secondAdapter.setValue(newSecond);
- firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond);
- }
-
- public Integer getMillisecond() {
- return this.millisecond;
- }
-
- public void setMillisecond(Integer newMillisecond) {
- if (attributeValueHasNotChanged(this.millisecond, newMillisecond)) {
- return;
- }
- Integer oldMillisecond = this.millisecond;
- this.millisecond = newMillisecond;
- this.millisecondAdapter.setValue(newMillisecond);
- firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond);
- }
-
- public TextRange getHourTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.hourDeclarationAdapter, astRoot);
- }
-
- public TextRange getMinuteTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.minuteDeclarationAdapter, astRoot);
- }
-
- public TextRange getSecondTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.secondDeclarationAdapter, astRoot);
- }
-
- public TextRange getMillisecondTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.millisecondDeclarationAdapter, astRoot);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.hour = this.hour(astRoot);
- this.minute = this.minute(astRoot);
- this.second = this.second(astRoot);
- this.millisecond = this.millisecond(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setHour(this.hour(astRoot));
- this.setMinute(this.minute(astRoot));
- this.setSecond(this.second(astRoot));
- this.setMillisecond(this.millisecond(astRoot));
- }
-
- protected Integer hour(CompilationUnit astRoot) {
- return this.hourAdapter.getValue(astRoot);
- }
-
- protected Integer minute(CompilationUnit astRoot) {
- return this.minuteAdapter.getValue(astRoot);
- }
-
- protected Integer second(CompilationUnit astRoot) {
- return this.secondAdapter.getValue(astRoot);
- }
-
- protected Integer millisecond(CompilationUnit astRoot) {
- return this.millisecondAdapter.getValue(astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter buildHourAdapter(DeclarationAnnotationAdapter daa) {
- return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__HOUR, false, NumberIntegerExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildMinuteAdapter(DeclarationAnnotationAdapter daa) {
- return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__MINUTE, false, NumberIntegerExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildSecondAdapter(DeclarationAnnotationAdapter daa) {
- return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__SECOND, false, NumberIntegerExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildMillisecondAdapter(DeclarationAnnotationAdapter daa) {
- return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__MILLISECOND, false, NumberIntegerExpressionConverter.instance());
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConversionValueImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConversionValueImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConversionValueImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConversionValueImpl.java 2 Oct 2008 13:36:07 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.NestableConversionValue;
-import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
-
-
-public class ConversionValueImpl extends AbstractResourceAnnotation implements ConversionValueAnnotation, NestableConversionValue
-{
- // hold this so we can get the 'dataValue' text range
- private final DeclarationAnnotationElementAdapter dataValueDeclarationAdapter;
- // hold this so we can get the 'objectValue' text range
- private final DeclarationAnnotationElementAdapter objectValueDeclarationAdapter;
-
- private final AnnotationElementAdapter dataValueAdapter;
- private final AnnotationElementAdapter objectValueAdapter;
-
-
- private String dataValue;
- private String objectValue;
-
- public ConversionValueImpl(ObjectTypeConverterAnnotation parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
- this.dataValueDeclarationAdapter = this.dataValueAdapter(idaa);
- this.dataValueAdapter = this.buildAdapter(this.dataValueDeclarationAdapter);
- this.objectValueDeclarationAdapter = this.objectValueAdapter(idaa);
- this.objectValueAdapter = this.buildAdapter(this.objectValueDeclarationAdapter);
- }
-
- // ********** initialization **********
- protected AnnotationElementAdapter buildAdapter(DeclarationAnnotationElementAdapter daea) {
- return new ShortCircuitAnnotationElementAdapter(getMember(), daea);
- }
-
- protected DeclarationAnnotationElementAdapter dataValueAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, EclipseLinkJPA.CONVERSION_VALUE__DATA_VALUE, false);
- }
-
- protected DeclarationAnnotationElementAdapter objectValueAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, EclipseLinkJPA.CONVERSION_VALUE__OBJECT_VALUE, false);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.dataValue = this.dataValue(astRoot);
- this.objectValue = this.objectValue(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public IndexedAnnotationAdapter getAnnotationAdapter() {
- return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
- }
-
- //*************** ConversionValue implementation ****************
- public String getDataValue() {
- return this.dataValue;
- }
-
- public void setDataValue(String newDataValue) {
- if (attributeValueHasNotChanged(this.dataValue, newDataValue)) {
- return;
- }
- String oldDataValue = this.dataValue;
- this.dataValue = newDataValue;
- this.dataValueAdapter.setValue(newDataValue);
- firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue);
- }
-
- public String getObjectValue() {
- return this.objectValue;
- }
-
- public void setObjectValue(String newObjectValue) {
- if (attributeValueHasNotChanged(this.objectValue, newObjectValue)) {
- return;
- }
- String oldObjectValue = this.objectValue;
- this.objectValue = newObjectValue;
- this.objectValueAdapter.setValue(newObjectValue);
- firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue);
- }
-
- public TextRange getDataValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.dataValueDeclarationAdapter, astRoot);
- }
-
- public TextRange getObjectValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.objectValueDeclarationAdapter, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setDataValue(this.dataValue(astRoot));
- this.setObjectValue(this.objectValue(astRoot));
- }
-
- protected String dataValue(CompilationUnit astRoot) {
- return this.dataValueAdapter.getValue(astRoot);
- }
-
- protected String objectValue(CompilationUnit astRoot) {
- return this.objectValueAdapter.getValue(astRoot);
- }
-
- //************ NestableAnnotation implementation
- public void moveAnnotation(int newIndex) {
- getAnnotationAdapter().moveAnnotation(newIndex);
- }
-
- public void initializeFrom(NestableAnnotation oldAnnotation) {
- ConversionValueAnnotation oldConversionValue = (ConversionValueAnnotation) oldAnnotation;
- setDataValue(oldConversionValue.getDataValue());
- setObjectValue(oldConversionValue.getObjectValue());
- }
-
- // ********** static methods **********
-
- static ConversionValueImpl createConversionValue(ObjectTypeConverterAnnotation parent, Member member, DeclarationAnnotationAdapter daa, int index) {
- return new ConversionValueImpl(parent, member, buildConversionValueAnnotationAdapter(daa, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildConversionValueAnnotationAdapter(DeclarationAnnotationAdapter daa, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(daa, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES, index, EclipseLinkJPA.CONVERSION_VALUE, false);
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertImpl.java 23 Oct 2008 19:04:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
-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.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-
-
-public class ConvertImpl extends AbstractResourceAnnotation implements ConvertAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter valueAdapter;
-
- private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
-
-
- private String value;
-
- protected ConvertImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter(attribute, VALUE_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.value(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** Convert implementation ****************
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- if (attributeValueHasNotChanged(this.value, newValue)) {
- return;
- }
- String oldValue = this.value;
- this.value = newValue;
- this.valueAdapter.setValue(newValue);
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.value(astRoot));
- }
-
- protected String value(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERT__VALUE, false, StringExpressionConverter.instance());
- }
-
-
- public static class ConvertAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final ConvertAnnotationDefinition INSTANCE = new ConvertAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static ConvertAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private ConvertAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new ConvertImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterImpl.java 23 Oct 2008 19:04:13 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.TypeStringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation;
-
-
-public class TypeConverterImpl extends AbstractResourceAnnotation implements TypeConverterAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter nameAdapter;
- private final AnnotationElementAdapter dataTypeAdapter;
- private final AnnotationElementAdapter objectTypeAdapter;
-
- private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = buildNameAdapter();
- private static final DeclarationAnnotationElementAdapter DATA_TYPE_ADAPTER = buildDataTypeAdapter();
- private static final DeclarationAnnotationElementAdapter OBJECT_TYPE_ADAPTER = buildObjectTypeAdapter();
-
-
- private String name;
- private String dataType;
- private String objectType;
-
- protected TypeConverterImpl(JavaResourcePersistentMember parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter(member, NAME_ADAPTER);
- this.dataTypeAdapter = new ShortCircuitAnnotationElementAdapter(member, DATA_TYPE_ADAPTER);
- this.objectTypeAdapter = new ShortCircuitAnnotationElementAdapter(member, OBJECT_TYPE_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.name(astRoot);
- this.dataType = this.dataType(astRoot);
- this.objectType = this.objectType(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** TypeConverter implementation ****************
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- if (attributeValueHasNotChanged(this.name, newName)) {
- return;
- }
- String oldName = this.name;
- this.name = newName;
- this.nameAdapter.setValue(newName);
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- public String getDataType() {
- return this.dataType;
- }
-
- public void setDataType(String newDataType) {
- if (attributeValueHasNotChanged(this.dataType, newDataType)) {
- return;
- }
- String oldDataType = this.dataType;
- this.dataType = newDataType;
- this.dataTypeAdapter.setValue(newDataType);
- firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType);
- }
-
- public String getObjectType() {
- return this.objectType;
- }
-
- public void setObjectType(String newObjectType) {
- if (attributeValueHasNotChanged(this.objectType, newObjectType)) {
- return;
- }
- String oldObjectType = this.objectType;
- this.objectType = newObjectType;
- this.objectTypeAdapter.setValue(newObjectType);
- firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(NAME_ADAPTER, astRoot);
- }
-
- public TextRange getDataTypeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(DATA_TYPE_ADAPTER, astRoot);
- }
-
- public TextRange getObjectTypeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(OBJECT_TYPE_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.name(astRoot));
- this.setDataType(this.dataType(astRoot));
- this.setObjectType(this.objectType(astRoot));
- }
-
- protected String name(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- protected String dataType(CompilationUnit astRoot) {
- return this.dataTypeAdapter.getValue(astRoot);
- }
-
- protected String objectType(CompilationUnit astRoot) {
- return this.objectTypeAdapter.getValue(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildNameAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TYPE_CONVERTER__NAME, false, StringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildDataTypeAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TYPE_CONVERTER__DATE_TYPE, false, TypeStringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildObjectTypeAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TYPE_CONVERTER__OBJECT_TYPE, false, TypeStringExpressionConverter.instance());
- }
-
- public static class TypeConverterAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final TypeConverterAnnotationDefinition INSTANCE = new TypeConverterAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static TypeConverterAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private TypeConverterAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new TypeConverterImpl(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterImpl.java 10 Mar 2009 04:12:12 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-
-
-public class ConverterImpl extends AbstractResourceAnnotation implements ConverterAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter nameAdapter;
- private final AnnotationElementAdapter converterClassAdapter;
-
- private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = buildNameAdapter();
- private static final DeclarationAnnotationElementAdapter CONVERTER_CLASS_ADAPTER = buildConverterClassAdapter();
-
-
- private String name;
- private String converterClass;
-
- protected ConverterImpl(JavaResourcePersistentMember parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter(member, NAME_ADAPTER);
- this.converterClassAdapter = new ShortCircuitAnnotationElementAdapter(member, CONVERTER_CLASS_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.name(astRoot);
- this.converterClass = this.converterClass(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** ConverterAnnotation implementation ****************
-
- public boolean converterClassImplementsInterface(String interfaceName, CompilationUnit astRoot) {
- return (this.converterClass != null)
- && JDTTools.typeIsSubTypeOf(this.converterClassAdapter.getExpression(astRoot), interfaceName);
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- if (attributeValueHasNotChanged(this.name, newName)) {
- return;
- }
- String oldName = this.name;
- this.name = newName;
- this.nameAdapter.setValue(newName);
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- public String getConverterClass() {
- return this.converterClass;
- }
-
- public void setConverterClass(String newConverterClass) {
- if (attributeValueHasNotChanged(this.converterClass, newConverterClass)) {
- return;
- }
- String oldConverterClass = this.converterClass;
- this.converterClass = newConverterClass;
- this.converterClassAdapter.setValue(newConverterClass);
- firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(NAME_ADAPTER, astRoot);
- }
-
- public TextRange getConverterClassTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(CONVERTER_CLASS_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.name(astRoot));
- this.setConverterClass(this.converterClass(astRoot));
- }
-
- protected String name(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- protected String converterClass(CompilationUnit astRoot) {
- return this.converterClassAdapter.getValue(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildNameAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERTER__NAME, false, StringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildConverterClassAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERTER__CONVERTER_CLASS, false, SimpleTypeStringExpressionConverter.instance());
- }
-
- public static class ConverterAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final ConverterAnnotationDefinition INSTANCE = new ConverterAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static ConverterAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private ConverterAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new ConverterImpl(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerImpl.java 10 Mar 2009 04:12:12 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-
-
-public class CustomizerImpl extends AbstractResourceAnnotation implements CustomizerAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter valueAdapter;
-
- private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
-
-
- private String value;
-
- protected CustomizerImpl(JavaResourcePersistentMember parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter(type, VALUE_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.value(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** CustomizerAnnotation implementation ****************
-
- public boolean customizerClassImplementsInterface(String interfaceName, CompilationUnit astRoot) {
- return (this.value != null)
- && JDTTools.typeIsSubTypeOf(this.valueAdapter.getExpression(astRoot), interfaceName);
- }
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- if (attributeValueHasNotChanged(this.value, newValue)) {
- return;
- }
- String oldValue = this.value;
- this.value = newValue;
- this.valueAdapter.setValue(newValue);
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.value(astRoot));
- }
-
- protected String value(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CUSTOMIZER__VALUE, false, SimpleTypeStringExpressionConverter.instance());
- }
-
- public static class CustomizerAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final CustomizerAnnotationDefinition INSTANCE = new CustomizerAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static CustomizerAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private CustomizerAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new CustomizerImpl(parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapImpl.java 11 Nov 2008 15:47:18 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.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.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation;
-
-
-public class BasicMapImpl extends AbstractResourceAnnotation implements BasicMapAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- protected BasicMapImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void update(CompilationUnit astRoot) {
- }
-
- public static class BasicMapAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final BasicMapAnnotationDefinition INSTANCE = new BasicMapAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static BasicMapAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private BasicMapAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new BasicMapImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedImpl.java 23 Oct 2008 19:04:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation;
-
-
-public class PrivateOwnedImpl extends AbstractResourceAnnotation implements PrivateOwnedAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- protected PrivateOwnedImpl(JavaResourceNode parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- //nothing to initialize
- }
-
- public void update(CompilationUnit astRoot) {
- //nothing to update
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- public static class PrivateOwnedAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final PrivateOwnedAnnotationDefinition INSTANCE = new PrivateOwnedAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PrivateOwnedAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new PrivateOwnedImpl(parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullJoinFetchAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullJoinFetchAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 NullJoinFetchAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullJoinFetchAnnotation.java 20 Oct 2008 20:52:59 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullJoinFetchAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,70 +10,45 @@
package org.eclipse.jpt.eclipselink.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation;
import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType;
-public class NullJoinFetchAnnotation extends AbstractJavaResourceNode implements JoinFetchAnnotation, Annotation
+/**
+ * org.eclipse.persistence.annotations.JoinFetch
+ */
+public class NullJoinFetchAnnotation
+ extends NullAnnotation
+ implements JoinFetchAnnotation
{
protected NullJoinFetchAnnotation(JavaResourcePersistentAttribute parent) {
super(parent);
}
-
- @Override
- public JavaResourcePersistentType getParent() {
- return (JavaResourcePersistentType) super.getParent();
- }
-
+
public String getAnnotationName() {
- return ExistenceCheckingAnnotation.ANNOTATION_NAME;
+ return ANNOTATION_NAME;
}
- public void initialize(CompilationUnit astRoot) {
- //null, nothing to initialize
- }
-
- public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) {
- return null;
- }
-
- public void newAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- protected JoinFetchAnnotation createJoinFetchAnnotation() {
- return (JoinFetchAnnotation) getParent().addSupportingAnnotation(getAnnotationName());
+ @Override
+ protected JoinFetchAnnotation buildSupportingAnnotation() {
+ return (JoinFetchAnnotation) super.buildSupportingAnnotation();
}
-
+
+ // ***** value
public JoinFetchType getValue() {
return null;
}
-
+
public void setValue(JoinFetchType value) {
if (value != null) {
- createJoinFetchAnnotation().setValue(value);
+ this.buildSupportingAnnotation().setValue(value);
}
}
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return null;
- }
-
+
public TextRange getValueTextRange(CompilationUnit astRoot) {
return null;
}
-
- public void update(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullCacheAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullCacheAnnotation.java,v
retrieving revision 1.4
diff -u -r1.4 NullCacheAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullCacheAnnotation.java 20 Oct 2008 20:52:58 -0000 1.4
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullCacheAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,8 +10,7 @@
package org.eclipse.jpt.eclipselink.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
@@ -19,175 +18,162 @@
import org.eclipse.jpt.eclipselink.core.resource.java.CacheType;
import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
-public class NullCacheAnnotation extends AbstractJavaResourceNode implements CacheAnnotation, Annotation
+/**
+ * org.eclipse.persistence.annotations.Cache
+ */
+public class NullCacheAnnotation
+ extends NullAnnotation
+ implements CacheAnnotation
{
+
protected NullCacheAnnotation(JavaResourcePersistentType parent) {
super(parent);
}
-
- @Override
- public JavaResourcePersistentType getParent() {
- return (JavaResourcePersistentType) super.getParent();
- }
-
+
public String getAnnotationName() {
- return CacheAnnotation.ANNOTATION_NAME;
+ return ANNOTATION_NAME;
}
- public void initialize(CompilationUnit astRoot) {
- //null, nothing to initialize
- }
-
- public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) {
- return null;
- }
-
- public void newAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- protected CacheAnnotation createCacheResource() {
- return (CacheAnnotation) getParent().addSupportingAnnotation(getAnnotationName());
+ @Override
+ protected CacheAnnotation buildSupportingAnnotation() {
+ return (CacheAnnotation) super.buildSupportingAnnotation();
}
-
+
+ // ***** type
public CacheType getType() {
return null;
}
-
+
public void setType(CacheType type) {
if (type != null) {
- createCacheResource().setType(type);
+ this.buildSupportingAnnotation().setType(type);
}
}
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** size
public Integer getSize() {
return null;
}
-
+
public void setSize(Integer size) {
if (size != null) {
- createCacheResource().setSize(size);
+ this.buildSupportingAnnotation().setSize(size);
}
}
-
+
+ public TextRange getSizeTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** shared
public Boolean getShared() {
return null;
}
-
+
public void setShared(Boolean shared) {
if (shared != null) {
- createCacheResource().setShared(shared);
+ this.buildSupportingAnnotation().setShared(shared);
}
}
-
+
+ public TextRange getSharedTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** expiry
public Integer getExpiry() {
return null;
}
-
+
public void setExpiry(Integer expiry) {
if (expiry != null) {
- createCacheResource().setExpiry(expiry);
- }
+ this.buildSupportingAnnotation().setExpiry(expiry);
+ }
+ }
+
+ public TextRange getExpiryTextRange(CompilationUnit astRoot) {
+ return null;
}
-
+
+ // ***** expiry time of day
public TimeOfDayAnnotation getExpiryTimeOfDay() {
return null;
}
-
+
public TimeOfDayAnnotation addExpiryTimeOfDay() {
- return createCacheResource().addExpiryTimeOfDay();
+ return this.buildSupportingAnnotation().addExpiryTimeOfDay();
}
-
+
public void removeExpiryTimeOfDay() {
-
+ // do nothing
}
-
+
+ public TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** always refresh
public Boolean getAlwaysRefresh() {
return null;
}
-
+
public void setAlwaysRefresh(Boolean alwaysRefresh) {
if (alwaysRefresh != null) {
- createCacheResource().setAlwaysRefresh(alwaysRefresh);
+ this.buildSupportingAnnotation().setAlwaysRefresh(alwaysRefresh);
}
}
-
+
+ public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** refresh only if newer
public Boolean getRefreshOnlyIfNewer() {
return null;
}
-
+
public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) {
if (refreshOnlyIfNewer != null) {
- createCacheResource().setRefreshOnlyIfNewer(refreshOnlyIfNewer);
+ this.buildSupportingAnnotation().setRefreshOnlyIfNewer(refreshOnlyIfNewer);
}
}
-
+
+ public TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** disable hits
public Boolean getDisableHits() {
return null;
}
-
+
public void setDisableHits(Boolean disableHits) {
if (disableHits != null) {
- createCacheResource().setDisableHits(disableHits);
+ this.buildSupportingAnnotation().setDisableHits(disableHits);
}
}
-
+
+ public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** coordination type
public CacheCoordinationType getCoordinationType() {
return null;
}
-
+
public void setCoordinationType(CacheCoordinationType coordinationType) {
if (coordinationType != null) {
- createCacheResource().setCoordinationType(coordinationType);
+ this.buildSupportingAnnotation().setCoordinationType(coordinationType);
}
}
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getTypeTextRange(CompilationUnit astRoot) {
- return null;
- }
- public TextRange getSizeTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getSharedTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getExpiryTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) {
- return null;
- }
-
public TextRange getCoordinationTypeTextRange(CompilationUnit astRoot) {
return null;
}
-
- public void update(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingImpl.java 23 Oct 2008 19:04:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.core.utility.jdt.Type;
-import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
-import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-
-
-public class ChangeTrackingImpl extends AbstractResourceAnnotation implements ChangeTrackingAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter valueAdapter;
-
- private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
-
-
- private ChangeTrackingType value;
-
- protected ChangeTrackingImpl(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter(type, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** CacheAnnotation implementation ****************
-
- public ChangeTrackingType getValue() {
- return this.value;
- }
-
- public void setValue(ChangeTrackingType newValue) {
- if (attributeValueHasNotChanged(this.value, newValue)) {
- return;
- }
- ChangeTrackingType oldValue = this.value;
- this.value = newValue;
- this.valueAdapter.setValue(ChangeTrackingType.toJavaAnnotationValue(newValue));
- firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.value(astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setValue(this.value(astRoot));
- }
-
- protected ChangeTrackingType value(CompilationUnit astRoot) {
- return ChangeTrackingType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter buildValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CHANGE_TRACKING__VALUE, false);
- }
-
- public static class ChangeTrackingAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final ChangeTrackingAnnotationDefinition INSTANCE = new ChangeTrackingAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static ChangeTrackingAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private ChangeTrackingAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new ChangeTrackingImpl((JavaResourcePersistentType) parent, (Type) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerImpl.java 23 Oct 2008 19:04:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-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.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.ReadTransformerAnnotation;
-
-
-public class ReadTransformerImpl extends AbstractResourceAnnotation implements ReadTransformerAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter transformerClassAdapter;
- private final AnnotationElementAdapter methodAdapter;
-
- private static final DeclarationAnnotationElementAdapter TRANSFORMER_CLASS_ADAPTER = buildTransformerClassAdapter();
- private static final DeclarationAnnotationElementAdapter METHOD_ADAPTER = buildMethodAdapter();
-
-
- private String transformerClass;
- private String method;
-
- protected ReadTransformerImpl(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.transformerClassAdapter = new ShortCircuitAnnotationElementAdapter(attribute, TRANSFORMER_CLASS_ADAPTER);
- this.methodAdapter = new ShortCircuitAnnotationElementAdapter(attribute, METHOD_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.transformerClass = this.transformerClass(astRoot);
- this.method = this.method(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** ReadTransformer implementation ****************
- public String getTransformerClass() {
- return this.transformerClass;
- }
-
- public void setTransformerClass(String newTransformerClass) {
- if (attributeValueHasNotChanged(this.transformerClass, newTransformerClass)) {
- return;
- }
- String oldTransformerClass = this.transformerClass;
- this.transformerClass = newTransformerClass;
- this.transformerClassAdapter.setValue(newTransformerClass);
- firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, oldTransformerClass, newTransformerClass);
- }
-
- public String getMethod() {
- return this.method;
- }
-
- public void setMethod(String newMethod) {
- if (attributeValueHasNotChanged(this.method, newMethod)) {
- return;
- }
- String oldMethod = this.method;
- this.method = newMethod;
- this.methodAdapter.setValue(newMethod);
- firePropertyChanged(METHOD_PROPERTY, oldMethod, newMethod);
- }
-
- public TextRange getTransformerClassTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(TRANSFORMER_CLASS_ADAPTER, astRoot);
- }
-
- public TextRange getMethodTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(METHOD_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setTransformerClass(this.transformerClass(astRoot));
- this.setMethod(this.method(astRoot));
- }
-
- protected String transformerClass(CompilationUnit astRoot) {
- return this.transformerClassAdapter.getValue(astRoot);
- }
-
- protected String method(CompilationUnit astRoot) {
- return this.methodAdapter.getValue(astRoot);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildTransformerClassAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.READ_TRANSFORMER__TRANSFORMER_CLASS, false, SimpleTypeStringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildMethodAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.READ_TRANSFORMER__METHOD, false);
- }
-
- public static class ReadTransformerAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final ReadTransformerAnnotationDefinition INSTANCE = new ReadTransformerAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static ReadTransformerAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private ReadTransformerAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new ReadTransformerImpl((JavaResourcePersistentAttribute) parent, (Attribute) member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterImpl.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterImpl.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterImpl.java
--- src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterImpl.java 29 Oct 2008 21:29:03 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.eclipselink.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation;
-import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
-import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation;
-
-
-public class StructConverterImpl extends AbstractResourceAnnotation implements StructConverterAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final AnnotationElementAdapter nameAdapter;
- private final AnnotationElementAdapter converterAdapter;
-
- private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = buildNameAdapter();
- private static final DeclarationAnnotationElementAdapter CONVERTER_ADAPTER = buildConverterAdapter();
-
-
- private String name;
- private String converter;
-
- protected StructConverterImpl(JavaResourcePersistentMember parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter(member, NAME_ADAPTER);
- this.converterAdapter = new ShortCircuitAnnotationElementAdapter(member, CONVERTER_ADAPTER);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.name(astRoot);
- this.converter = this.converter(astRoot);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- //*************** CustomConverter implementation ****************
- public String getName() {
- return this.name;
- }
-
- public void setName(String newName) {
- if (attributeValueHasNotChanged(this.name, newName)) {
- return;
- }
- String oldName = this.name;
- this.name = newName;
- this.nameAdapter.setValue(newName);
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
- }
-
- public String getConverter() {
- return this.converter;
- }
-
- public void setConverter(String newConverter) {
- if (attributeValueHasNotChanged(this.converter, newConverter)) {
- return;
- }
- String oldConverter = this.converter;
- this.converter = newConverter;
- this.converterAdapter.setValue(newConverter);
- firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(NAME_ADAPTER, astRoot);
- }
-
- public TextRange getConverterTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(CONVERTER_ADAPTER, astRoot);
- }
-
- public void update(CompilationUnit astRoot) {
- this.setName(this.name(astRoot));
- this.setConverter(this.converter(astRoot));
- }
-
- protected String name(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- protected String converter(CompilationUnit astRoot) {
- return this.converterAdapter.getValue(astRoot);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter buildNameAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.STRUCT_CONVERTER__NAME, false, StringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter buildConverterAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.STRUCT_CONVERTER__CONVERTER, false, StringExpressionConverter.instance());
- }
-
- public static class StructConverterAnnotationDefinition implements AnnotationDefinition
- {
- // singleton
- private static final StructConverterAnnotationDefinition INSTANCE = new StructConverterAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static StructConverterAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private StructConverterAnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
- return new StructConverterImpl(parent, member);
- }
-
- public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) {
- return null;
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
- }
-
-}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/VariableOneToOneAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/VariableOneToOneAnnotation.java,v
retrieving revision 1.1
diff -u -r1.1 VariableOneToOneAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/VariableOneToOneAnnotation.java 6 Jan 2009 22:48:26 -0000 1.1
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/VariableOneToOneAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -9,11 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.resource.java;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.VariableOneToOne
+ * Corresponds to EclipseLink annotation
+ * org.eclipse.persistence.annotations.VariableOneToOne
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -24,7 +24,8 @@
* @version 2.2
* @since 2.2
*/
-public interface VariableOneToOneAnnotation extends JavaResourceNode
+public interface VariableOneToOneAnnotation
+ extends Annotation
{
String ANNOTATION_NAME = EclipseLinkJPA.VARIABLE_ONE_TO_ONE;
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/TimeOfDayAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/TimeOfDayAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 TimeOfDayAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/TimeOfDayAnnotation.java 29 Sep 2008 21:47:24 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/TimeOfDayAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Resource model interface that represents the
- * org.eclipse.persistence.annotations.TimeOfDay annotation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.TimeOfDay
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,88 +26,88 @@
* @version 2.1
* @since 2.1
*/
-public interface TimeOfDayAnnotation extends JavaResourceNode
+public interface TimeOfDayAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.TIME_OF_DAY;
-
+
/**
- * Corresponds to the hour element of the TimeOfDay annotation.
- * Returns null if the hour valuePair does not exist in the annotation
+ * Corresponds to the 'hour' element of the TimeOfDay annotation.
+ * Return null if the element does not exist in the annotation.
*/
Integer getHour();
-
+ String HOUR_PROPERTY = "hour"; //$NON-NLS-1$
+
/**
- * Corresponds to the hour element of the TimeOfDay annotation.
- * Set to null to remove the hour valuePair from the annotation
+ * Corresponds to the 'hour' element of the TimeOfDay annotation.
+ * Set to null to remove the element from the annotation
*/
void setHour(Integer hour);
- String HOUR_PROPERTY = "hourProperty"; //$NON-NLS-1$
-
+
/**
- * Corresponds to the minute element of the TimeOfDay annotation.
- * Returns null if the minute valuePair does not exist in the annotation
+ * Return the {@link TextRange} for the 'hour' element. If the element
+ * does not exist return the {@link TextRange} for the TimeOfDay annotation.
*/
- Integer getMinute();
-
+ TextRange getHourTextRange(CompilationUnit astRoot);
+
+
/**
- * Corresponds to the minute element of the TimeOfDay annotation.
- * Set to null to remove the minute valuePair from the annotation
+ * Corresponds to the 'minute' element of the TimeOfDay annotation.
+ * Return null if the element does not exist in the annotation.
*/
- void setMinute(Integer minute);
- String MINUTE_PROPERTY = "minuteProperty"; //$NON-NLS-1$
-
+ Integer getMinute();
+ String MINUTE_PROPERTY = "minute"; //$NON-NLS-1$
+
/**
- * Corresponds to the second element of the TimeOfDay annotation.
- * Returns null if the second valuePair does not exist in the annotation
+ * Corresponds to the 'minute' element of the TimeOfDay annotation.
+ * Set to null to remove the element from the annotation
*/
- Integer getSecond();
-
+ void setMinute(Integer minute);
+
/**
- * Corresponds to the second element of the TimeOfDay annotation.
- * Set to null to remove the second valuePair from the annotation
+ * Return the {@link TextRange} for the 'minute' element. If the element
+ * does not exist return the {@link TextRange} for the TimeOfDay annotation.
*/
- void setSecond(Integer second);
- String SECOND_PROPERTY = "secondProperty"; //$NON-NLS-1$
+ TextRange getMinuteTextRange(CompilationUnit astRoot);
+
-
/**
- * Corresponds to the millisecond element of the TimeOfDay annotation.
- * Returns null if the millisecond valuePair does not exist in the annotation
+ * Corresponds to the 'second' element of the TimeOfDay annotation.
+ * Return null if the element does not exist in the annotation.
*/
- Integer getMillisecond();
-
+ Integer getSecond();
+ String SECOND_PROPERTY = "second"; //$NON-NLS-1$
+
/**
- * Corresponds to the millisecond element of the TimeOfDay annotation.
- * Set to null to remove the millisecond valuePair from the annotation
+ * Corresponds to the 'second' element of the TimeOfDay annotation.
+ * Set to null to remove the element from the annotation
*/
- void setMillisecond(Integer millisecond);
- String MILLISECOND_PROPERTY = "millisecondProperty"; //$NON-NLS-1$
-
-
+ void setSecond(Integer second);
+
/**
- * Return the {@link TextRange} for the hour element. If the hour element
+ * Return the {@link TextRange} for the 'second' element. If the element
* does not exist return the {@link TextRange} for the TimeOfDay annotation.
*/
- TextRange getHourTextRange(CompilationUnit astRoot);
-
+ TextRange getSecondTextRange(CompilationUnit astRoot);
+
+
/**
- * Return the {@link TextRange} for the minute element. If the minute element
- * does not exist return the {@link TextRange} for the TimeOfDay annotation.
+ * Corresponds to the 'millisecond' element of the TimeOfDay annotation.
+ * Return null if the element does not exist in the annotation.
*/
- TextRange getMinuteTextRange(CompilationUnit astRoot);
-
+ Integer getMillisecond();
+ String MILLISECOND_PROPERTY = "millisecond"; //$NON-NLS-1$
+
/**
- * Return the {@link TextRange} for the second element. If the second element
- * does not exist return the {@link TextRange} for the TimeOfDay annotation.
+ * Corresponds to the 'millisecond' element of the TimeOfDay annotation.
+ * Set to null to remove the element from the annotation
*/
- TextRange getSecondTextRange(CompilationUnit astRoot);
-
+ void setMillisecond(Integer millisecond);
+
/**
- * Return the {@link TextRange} for the millisecond element. If the millisecond element
+ * Return the {@link TextRange} for the 'millisecond' element. If the element
* does not exist return the {@link TextRange} for the TimeOfDay annotation.
*/
TextRange getMillisecondTextRange(CompilationUnit astRoot);
-
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/ConvertAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/ConvertAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 ConvertAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/ConvertAnnotation.java 29 Sep 2008 21:47:24 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/ConvertAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.Convert
+ * Corresponds to the Eclipselink annotation
+ * org.eclipse.persistence.annotations.Convert
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,27 +26,26 @@
* @version 2.1
* @since 2.1
*/
-public interface ConvertAnnotation extends JavaResourceNode
+public interface ConvertAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.CONVERT;
-
/**
- * Corresponds to the value element of the Convert annotation.
- * Returns null if the value element does not exist in java.
+ * Corresponds to the 'value' element of the Convert annotation.
+ * Return null if the element does not exist in Java.
*/
String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
/**
- * Corresponds to the value element of the Convert annotation.
- * Set to null to remove the value element.
+ * Corresponds to the 'value' element of the Convert annotation.
+ * Set to null to remove the element.
*/
void setValue(String value);
- String VALUE_PROPERTY = "valueProperty"; //$NON-NLS-1$
/**
- * Return the {@link TextRange} for the value element. If the value element
+ * Return the {@link TextRange} for the 'value' element. If the element
* does not exist return the {@link TextRange} for the Convert annotation.
*/
TextRange getValueTextRange(CompilationUnit astRoot);
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/CustomizerAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/CustomizerAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 CustomizerAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/CustomizerAnnotation.java 30 Dec 2008 15:47:46 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/CustomizerAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.Converter
+ * Corresponds to the Eclipselink annotation
+ * org.eclipse.persistence.annotations.Customizer
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,34 +26,34 @@
* @version 2.1
* @since 2.1
*/
-public interface CustomizerAnnotation extends JavaResourceNode
+public interface CustomizerAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.CUSTOMIZER;
/**
- * Corresponds to the value element of the Customizer annotation.
- * Returns null if the value element does not exist in java.
+ * Corresponds to the 'value' element of the Customizer annotation.
+ * Return null if the element does not exist in Java.
*/
String getValue();
-
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
/**
- * Corresponds to the value element of the Customizer annotation.
- * Set to null to remove the value element.
+ * Corresponds to the 'value' element of the Customizer annotation.
+ * Set to null to remove the element.
*/
void setValue(String value);
- String VALUE_PROPERTY = "valueProperty"; //$NON-NLS-1$
/**
- * Return whether the converterClass implements the eclipselink Customizer interface
- * @see org.eclipse.jpt.eclipselink.core.context.Customizer#ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME
+ * Return the {@link TextRange} for the 'value' element. If the element
+ * does not exist return the {@link TextRange} for the Customizer annotation.
*/
- boolean customizerClassImplementsInterface(String interfaceName, CompilationUnit astRoot);
+ TextRange getValueTextRange(CompilationUnit astRoot);
/**
- * Return the {@link TextRange} for the value element. If the value element
- * does not exist return the {@link TextRange} for the Customizer annotation.
+ * Return whether the customizer class implements the specified interface.
+ * @see org.eclipse.jpt.eclipselink.core.context.Customizer#ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME
*/
- TextRange getValueTextRange(CompilationUnit astRoot);
+ boolean customizerClassImplementsInterface(String interfaceName, CompilationUnit astRoot);
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/ConversionValueAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/ConversionValueAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 ConversionValueAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/ConversionValueAnnotation.java 29 Sep 2008 21:47:24 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/ConversionValueAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.ConversionValue
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.ConversionValue
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,46 +26,46 @@
* @version 2.1
* @since 2.1
*/
-public interface ConversionValueAnnotation extends JavaResourceNode
+public interface ConversionValueAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.CONVERSION_VALUE;
-
-
+
/**
- * Corresponds to the dataValue element of the ConversionValue annotation.
- * Returns null if the dataValue element does not exist in java.
+ * Corresponds to the 'dataValue' element of the ConversionValue annotation.
+ * Return null if the element does not exist in Java.
*/
String getDataValue();
-
+ String DATA_VALUE_PROPERTY = "dataValue"; //$NON-NLS-1$
+
/**
- * Corresponds to the dataValue element of the ConversionValue annotation.
- * Set to null to remove the dataValue element.
+ * Corresponds to the 'dataValue' element of the ConversionValue annotation.
+ * Set to null to remove the element.
*/
void setDataValue(String dataValue);
- String DATA_VALUE_PROPERTY = "dataValueProperty"; //$NON-NLS-1$
/**
- * Corresponds to the objectValue element of the ConversionValue annotation.
- * Returns null if the objectValue element does not exist in java.
+ * Return the {@link TextRange} for the 'dataValue' element. If the element
+ * does not exist return the {@link TextRange} for the ConversionValue annotation.
*/
- String getObjectValue();
-
+ TextRange getDataValueTextRange(CompilationUnit astRoot);
+
+
/**
- * Corresponds to the objectValue element of the ConversionValue annotation.
- * Set to null to remove the objectValue element.
+ * Corresponds to the 'objectValue' element of the ConversionValue annotation.
+ * Return null if the element does not exist in Java.
*/
- void setObjectValue(String objectValue);
- String OBJECT_VALUE_PROPERTY = "objectValueProperty"; //$NON-NLS-1$
-
+ String getObjectValue();
+ String OBJECT_VALUE_PROPERTY = "objectValue"; //$NON-NLS-1$
+
/**
- * Return the {@link TextRange} for the dataValue element. If the dataValue element
- * does not exist return the {@link TextRange} for the ConversionValue annotation.
+ * Corresponds to the 'objectValue' element of the ConversionValue annotation.
+ * Set to null to remove the element.
*/
- TextRange getDataValueTextRange(CompilationUnit astRoot);
-
+ void setObjectValue(String objectValue);
+
/**
- * Return the {@link TextRange} for the objectValue element. If the objectValue element
+ * Return the {@link TextRange} for the 'objectValue' element. If the element
* does not exist return the {@link TextRange} for the ConversionValue annotation.
*/
TextRange getObjectValueTextRange(CompilationUnit astRoot);
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/NamedConverterAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/NamedConverterAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 NamedConverterAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/NamedConverterAnnotation.java 3 Nov 2008 16:58:54 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/NamedConverterAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,20 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2008 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
- *******************************************************************************/
+ * Copyright (c) 2008, 2009 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.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
+ * Common protocol among:
+ * org.eclipse.persistence.annotations.Converter
+ * org.eclipse.persistence.annotations.StructConverter
+ * org.eclipse.persistence.annotations.TypeConverter
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ *
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -24,24 +29,26 @@
* @version 2.1
* @since 2.1
*/
-public interface NamedConverterAnnotation extends JavaResourceNode
+public interface NamedConverterAnnotation
+ extends Annotation
{
/**
- * Corresponds to the name element of the CustomConverter annotation.
- * Returns null if the name element does not exist in java.
+ * Corresponds to the 'name' element of the *Converter annotation.
+ * Return null if the element does not exist in Java.
*/
String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
/**
- * Corresponds to the name element of the CustomConverter annotation.
- * Set to null to remove the name element.
+ * Corresponds to the 'name' element of the *Converter annotation.
+ * Set to null to remove the element.
*/
void setName(String value);
- String NAME_PROPERTY = "nameProperty"; //$NON-NLS-1$
/**
- * Return the {@link TextRange} for the name element. If the name element
+ * Return the {@link TextRange} for the 'name' element. If the element
* does not exist return the {@link TextRange} for the CustomConverter annotation.
*/
TextRange getNameTextRange(CompilationUnit astRoot);
+
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/TypeConverterAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/TypeConverterAnnotation.java,v
retrieving revision 1.3
diff -u -r1.3 TypeConverterAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/TypeConverterAnnotation.java 29 Oct 2008 21:29:03 -0000 1.3
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/TypeConverterAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -9,12 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.resource.java;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.utility.TextRange;
-
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.TypeConverter
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.TypeConverter
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -25,45 +22,8 @@
* @version 2.1
* @since 2.1
*/
-public interface TypeConverterAnnotation extends NamedConverterAnnotation
+public interface TypeConverterAnnotation
+ extends BaseTypeConverterAnnotation
{
String ANNOTATION_NAME = EclipseLinkJPA.TYPE_CONVERTER;
-
- /**
- * Corresponds to the dataType element of the TypeConverter annotation.
- * Returns null if the dataType element does not exist in java.
- */
- String getDataType();
-
- /**
- * Corresponds to the dataType element of the TypeConverter annotation.
- * Set to null to remove the dataType element.
- */
- void setDataType(String value);
- String DATA_TYPE_PROPERTY = "dataTypeProperty"; //$NON-NLS-1$
-
- /**
- * Corresponds to the objectType element of the TypeConverter annotation.
- * Returns null if the objectType element does not exist in java.
- */
- String getObjectType();
-
- /**
- * Corresponds to the objectType element of the TypeConverter annotation.
- * Set to null to remove the objectType element.
- */
- void setObjectType(String value);
- String OBJECT_TYPE_PROPERTY = "objectTypeProperty"; //$NON-NLS-1$
-
- /**
- * Return the {@link TextRange} for the dataType element. If the dataType element
- * does not exist return the {@link TextRange} for the TypeConverter annotation.
- */
- TextRange getDataTypeTextRange(CompilationUnit astRoot);
-
- /**
- * Return the {@link TextRange} for the objectType element. If the objectType element
- * does not exist return the {@link TextRange} for the TypeConverter annotation.
- */
- TextRange getObjectTypeTextRange(CompilationUnit astRoot);
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/ConverterAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/ConverterAnnotation.java,v
retrieving revision 1.5
diff -u -r1.5 ConverterAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/ConverterAnnotation.java 30 Dec 2008 15:47:46 -0000 1.5
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/ConverterAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -13,8 +13,8 @@
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.Converter
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.Converter
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -25,32 +25,34 @@
* @version 2.1
* @since 2.1
*/
-public interface ConverterAnnotation extends NamedConverterAnnotation
+public interface ConverterAnnotation
+ extends NamedConverterAnnotation
{
String ANNOTATION_NAME = EclipseLinkJPA.CONVERTER;
/**
- * Corresponds to the converterClass element of the CustomConverter annotation.
- * Returns null if the converterClass element does not exist in java.
+ * Corresponds to the 'converterClass' element of the Converter annotation.
+ * Returns null if the element does not exist in java.
*/
String getConverterClass();
+ String CONVERTER_CLASS_PROPERTY = "converterClass"; //$NON-NLS-1$
/**
- * Corresponds to the converterClass element of the CustomConverter annotation.
- * Set to null to remove the converterClass element.
+ * Corresponds to the 'converterClass' element of the Converter annotation.
+ * Set to null to remove the element.
*/
void setConverterClass(String value);
- String CONVERTER_CLASS_PROPERTY = "converterClass"; //$NON-NLS-1$
/**
- * Return whether the converterClass implements the eclipselink Converter interface
- * @see org.eclipse.jpt.eclipselink.core.context.CustomConverter#ECLIPSELINK_CONVERTER_CLASS_NAME
+ * Return the {@link TextRange} for the 'converterClass' element. If the element
+ * does not exist return the {@link TextRange} for the Converter annotation.
*/
- boolean converterClassImplementsInterface(String interfaceName, CompilationUnit astRoot);
+ TextRange getConverterClassTextRange(CompilationUnit astRoot);
/**
- * Return the {@link TextRange} for the converterClass element. If the converterClass element
- * does not exist return the {@link TextRange} for the CustomConverter annotation.
+ * Return whether the converter class implements the specified interface.
+ * @see org.eclipse.jpt.eclipselink.core.context.CustomConverter#ECLIPSELINK_CONVERTER_CLASS_NAME
*/
- TextRange getConverterClassTextRange(CompilationUnit astRoot);
+ boolean converterClassImplementsInterface(String interfaceName, CompilationUnit astRoot);
+
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/BasicMapAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/BasicMapAnnotation.java,v
retrieving revision 1.1
diff -u -r1.1 BasicMapAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/BasicMapAnnotation.java 11 Nov 2008 15:47:18 -0000 1.1
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/BasicMapAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -9,11 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.resource.java;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.BasicMap
+ * Corresponds to the Eclipselink annotation
+ * org.eclipse.persistence.annotations.BasicMap
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -24,7 +24,8 @@
* @version 2.1
* @since 2.1
*/
-public interface BasicMapAnnotation extends JavaResourceNode
+public interface BasicMapAnnotation
+ extends Annotation
{
String ANNOTATION_NAME = EclipseLinkJPA.BASIC_MAP;
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValue.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValue.java
diff -N src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValue.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValue.java 3 Sep 2008 20:02:10 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.eclipselink.core.resource.java;
-
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-
-/**
- *
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface NestableConversionValue extends ConversionValueAnnotation, NestableAnnotation
-{
- // nothing yet
-}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/BasicCollectionAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/BasicCollectionAnnotation.java,v
retrieving revision 1.1
diff -u -r1.1 BasicCollectionAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/BasicCollectionAnnotation.java 11 Nov 2008 15:47:18 -0000 1.1
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/BasicCollectionAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -9,11 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.resource.java;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.Transformation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.BasicCollection
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -24,7 +24,8 @@
* @version 2.1
* @since 2.1
*/
-public interface BasicCollectionAnnotation extends JavaResourceNode
+public interface BasicCollectionAnnotation
+ extends Annotation
{
String ANNOTATION_NAME = EclipseLinkJPA.BASIC_COLLECTION;
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/ReadOnlyAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/ReadOnlyAnnotation.java,v
retrieving revision 1.1
diff -u -r1.1 ReadOnlyAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/ReadOnlyAnnotation.java 7 Oct 2008 16:19:06 -0000 1.1
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/ReadOnlyAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -9,11 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.resource.java;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
/**
- * Resource model interface that represents the
- * org.eclipse.persistence.annotations.PrivateOwned annotation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.ReadOnly
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -24,8 +24,8 @@
* @version 2.1
* @since 2.1
*/
-public interface ReadOnlyAnnotation extends JavaResourceNode
+public interface ReadOnlyAnnotation
+ extends Annotation
{
String ANNOTATION_NAME = EclipseLinkJPA.READ_ONLY;
-
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/TransformationAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/TransformationAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 TransformationAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/TransformationAnnotation.java 29 Sep 2008 21:47:24 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/TransformationAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,13 +10,13 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.Transformation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.Transformation
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -27,45 +27,46 @@
* @version 2.1
* @since 2.1
*/
-public interface TransformationAnnotation extends JavaResourceNode
+public interface TransformationAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.TRANSFORMATION;
-
+
/**
- * Corresponds to the fetch element of the Transformation annotation.
- * Returns null if the fetch element does not exist in java.
+ * Corresponds to the 'fetch' element of the Transformation annotation.
+ * Return null if the element does not exist in Java.
*/
FetchType getFetch();
-
+ String FETCH_PROPERTY = "fetch"; //$NON-NLS-1$
+
/**
- * Corresponds to the fetch element of the Transformation annotation.
- * Set to null to remove the fetch element.
+ * Corresponds to the 'fetch' element of the Transformation annotation.
+ * Set to null to remove the element.
*/
void setFetch(FetchType fetch);
- String FETCH_PROPERTY = "fetchProperty"; //$NON-NLS-1$
-
+
/**
- * Corresponds to the optional element of the Transformation annotation.
- * Returns null if the optional element does not exist in java.
+ * Return the {@link TextRange} for the 'fetch' element. If the element
+ * does not exist return the {@link TextRange} for the Transformation annotation.
*/
- Boolean getOptional();
-
+ TextRange getFetchTextRange(CompilationUnit astRoot);
+
+
/**
- * Corresponds to the optional element of the Transformation annotation.
- * Set to null to remove the optional element.
+ * Corresponds to the 'optional' element of the Transformation annotation.
+ * Return null if the element does not exist in Java.
*/
- void setOptional(Boolean optional);
- String OPTIONAL_PROPERTY = "optionalProperty"; //$NON-NLS-1$
-
+ Boolean getOptional();
+ String OPTIONAL_PROPERTY = "optional"; //$NON-NLS-1$
+
/**
- * Return the {@link TextRange} for the fetch element. If the fetch element
- * does not exist return the {@link TextRange} for the Transformation annotation.
+ * Corresponds to the 'optional' element of the Transformation annotation.
+ * Set to null to remove the element.
*/
- TextRange getFetchTextRange(CompilationUnit astRoot);
-
+ void setOptional(Boolean optional);
+
/**
- * Return the {@link TextRange} for the optional element. If the optional element
+ * Return the {@link TextRange} for the 'optional' element. If the element
* does not exist return the {@link TextRange} for the Transformation annotation.
*/
TextRange getOptionalTextRange(CompilationUnit astRoot);
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/ChangeTrackingAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/ChangeTrackingAnnotation.java,v
retrieving revision 1.1
diff -u -r1.1 ChangeTrackingAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/ChangeTrackingAnnotation.java 9 Oct 2008 17:38:39 -0000 1.1
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/ChangeTrackingAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Resource model interface that represents the
- * org.eclipse.persistence.annotations.ChangeTracking annotation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.ChangeTracking
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,30 +26,28 @@
* @version 2.1
* @since 2.1
*/
-public interface ChangeTrackingAnnotation extends JavaResourceNode
+public interface ChangeTrackingAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.CHANGE_TRACKING;
-
+
/**
- * Corresponds to the value element of the ChangeTracking annotation.
- * Returns null if the value element does not exist in java.
+ * Corresponds to the 'value' element of the ChangeTracking annotation.
+ * Return null if the element does not exist in Java.
*/
ChangeTrackingType getValue();
-
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
/**
- * Corresponds to the value element of the ChangeTracking annotation.
- * Set to null to remove the value element.
+ * Corresponds to the 'value' element of the ChangeTracking annotation.
+ * Set to null to remove the element.
*/
void setValue(ChangeTrackingType value);
- String VALUE_PROPERTY = "valueProperty"; //$NON-NLS-1$
-
-
+
/**
- * Return the {@link TextRange} for the value element. If the value element
+ * Return the {@link TextRange} for the 'value' element. If the element
* does not exist return the {@link TextRange} for the ChangeTracking annotation.
*/
TextRange getValueTextRange(CompilationUnit astRoot);
-
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/TransformerAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/TransformerAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 TransformerAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/TransformerAnnotation.java 29 Sep 2008 21:47:24 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/TransformerAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,10 +10,14 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
+ * Common protocol among:
+ * org.eclipse.persistence.annotations.ReadTransformer
+ * org.eclipse.persistence.annotations.WriteTransformer
+ *
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -23,48 +27,49 @@
* @version 2.1
* @since 2.1
*/
-public interface TransformerAnnotation extends JavaResourceNode
+public interface TransformerAnnotation
+ extends Annotation
{
-
/**
- * Corresponds to the transformerClass element of the *Transformer annotation.
- * Returns null if the transformerClass element does not exist in java.
- * Returns the portion of the transformerClass preceding the .class.
- *
+ * Corresponds to the 'transformerClass' element of the *Transformer annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ *
- * will return "Employee"
- **/
+ *
+ * will return "Employee".
+ */
String getTransformerClass();
-
+ String TRANSFORMER_CLASS_PROPERTY = "transformerClass"; //$NON-NLS-1$
+
/**
- * Corresponds to the transformerClass element of the *Transformer annotation.
- * Set to null to remove the transformerClass element.
+ * Corresponds to the 'transformerClass' element of the *Transformer annotation.
+ * Set to null to remove the element.
*/
void setTransformerClass(String transformerClass);
- String TRANSFORMER_CLASS_PROPERTY = "transformerClassProperty"; //$NON-NLS-1$
/**
- * Corresponds to the method element of the *Transformer annotation.
- * Returns null if the method element does not exist in java.
- **/
- String getMethod();
-
+ * Return the {@link TextRange} for the 'transformerClass' element. If the element
+ * does not exist return the {@link TextRange} for the *Transformer annotation.
+ */
+ TextRange getTransformerClassTextRange(CompilationUnit astRoot);
+
+
/**
- * Corresponds to the method element of the *Transformer annotation.
- * Set to null to remove the method element.
+ * Corresponds to the 'method' element of the *Transformer annotation.
+ * Return null if the element does not exist in Java.
*/
- void setMethod(String method);
- String METHOD_PROPERTY = "methodProperty"; //$NON-NLS-1$
-
+ String getMethod();
+ String METHOD_PROPERTY = "method"; //$NON-NLS-1$
+
/**
- * Return the {@link TextRange} for the transformerClass element. If the transformerClass element
- * does not exist return the {@link TextRange} for the *Transformer annotation.
+ * Corresponds to the 'method' element of the *Transformer annotation.
+ * Set to null to remove the element.
*/
- TextRange getTransformerClassTextRange(CompilationUnit astRoot);
-
+ void setMethod(String method);
+
/**
- * Return the {@link TextRange} for the method element. If the method element
+ * Return the {@link TextRange} for the 'method' element. If the element
* does not exist return the {@link TextRange} for the *Transformer annotation.
*/
TextRange getMethodTextRange(CompilationUnit astRoot);
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/EclipseLinkJPA.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/EclipseLinkJPA.java,v
retrieving revision 1.12
diff -u -r1.12 EclipseLinkJPA.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/EclipseLinkJPA.java 6 Jan 2009 22:48:26 -0000 1.12
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/EclipseLinkJPA.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -9,9 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.resource.java;
-
/**
- * EclipseLink JPA Java-related stuff (annotations etc.)
+ * EclipseLink Java-related stuff (annotations etc.)
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -25,18 +24,16 @@
@SuppressWarnings("nls")
public interface EclipseLinkJPA {
- // EclipseLink JPA package
+ // EclipseLink package
String PACKAGE = "org.eclipse.persistence.annotations"; //$NON-NLS-1$
String PACKAGE_ = PACKAGE + ".";
// ********** API **********
- // JPA annotations
+ // EclispeLink annotations
String BASIC_COLLECTION = PACKAGE_ + "BasicCollection";
-
String BASIC_MAP = PACKAGE_ + "BasicMap";
-
String CACHE = PACKAGE_ + "Cache";
String CACHE__SHARED = "shared";
String CACHE__EXPIRY = "expiry";
@@ -47,111 +44,89 @@
String CACHE__REFRESH_ONLY_IF_NEWER = "refreshOnlyIfNewer";
String CACHE__DISABLE_HITS = "disableHits";
String CACHE__COORDINATION_TYPE = "coordinationType";
- String CACHE_TYPE = PACKAGE_ + "CacheType";
- String CACHE_TYPE_ = CACHE_TYPE + ".";
- String CACHE_TYPE__FULL = CACHE_TYPE_ + "FULL";
- String CACHE_TYPE__WEAK = CACHE_TYPE_ + "WEAK";
- String CACHE_TYPE__SOFT = CACHE_TYPE_ + "SOFT";
- String CACHE_TYPE__SOFT_WEAK = CACHE_TYPE_ + "SOFT_WEAK";
- String CACHE_TYPE__HARD_WEAK = CACHE_TYPE_ + "HARD_WEAK";
- String CACHE_TYPE__CACHE = CACHE_TYPE_ + "CACHE";
- String CACHE_TYPE__NONE = CACHE_TYPE_ + "NONE";
-
- String CACHE_COORDINATION_TYPE = PACKAGE_ + "CacheCoordinationType";
- String CACHE_COORDINATION_TYPE_ = CACHE_COORDINATION_TYPE + ".";
- String CACHE_COORDINATION_TYPE__SEND_OBJECT_CHANGES = CACHE_COORDINATION_TYPE_ + "SEND_OBJECT_CHANGES";
- String CACHE_COORDINATION_TYPE__INVALIDATE_CHANGED_OBJECTS = CACHE_COORDINATION_TYPE_ + "INVALIDATE_CHANGED_OBJECTS";
- String CACHE_COORDINATION_TYPE__SEND_NEW_OBJECTS_WITH_CHANGES = CACHE_COORDINATION_TYPE_ + "SEND_NEW_OBJECTS_WITH_CHANGES";
- String CACHE_COORDINATION_TYPE__NONE = CACHE_COORDINATION_TYPE_ + "NONE";
-
String CHANGE_TRACKING = PACKAGE_ + "ChangeTracking";
String CHANGE_TRACKING__VALUE = "value";
-
- String CHANGE_TRACKING_TYPE = PACKAGE_ + "ChangeTrackingType";
- String CHANGE_TRACKING_TYPE_ = CHANGE_TRACKING_TYPE + ".";
- String CHANGE_TRACKING_TYPE__ATTRIBUTE = CHANGE_TRACKING_TYPE_ + "ATTRIBUTE";
- String CHANGE_TRACKING_TYPE__OBJECT = CHANGE_TRACKING_TYPE_ + "OBJECT";
- String CHANGE_TRACKING_TYPE__DEFERRED = CHANGE_TRACKING_TYPE_ + "DEFERRED";
- String CHANGE_TRACKING_TYPE__AUTO = CHANGE_TRACKING_TYPE_ + "AUTO";
-
-
String CONVERSION_VALUE = PACKAGE_ + "ConversionValue";
String CONVERSION_VALUE__DATA_VALUE = "dataValue";
String CONVERSION_VALUE__OBJECT_VALUE = "objectValue";
-
String CONVERT = PACKAGE_ + "Convert";
String CONVERT__VALUE = "value";
-
String CONVERTER = PACKAGE_ + "Converter";
String CONVERTER__NAME = "name";
String CONVERTER__CONVERTER_CLASS = "converterClass";
-
String CUSTOMIZER = PACKAGE_ + "Customizer";
String CUSTOMIZER__VALUE = "value";
-
String EXISTENCE_CHECKING = PACKAGE_ + "ExistenceChecking";
String EXISTENCE_CHECKING__VALUE = "value";
-
- String EXISTENCE_TYPE = PACKAGE_ + "ExistenceType";
- String EXISTENCE_TYPE_ = EXISTENCE_TYPE + ".";
- String EXISTENCE_TYPE__CHECK_CACHE = EXISTENCE_TYPE_ + "CHECK_CACHE";
- String EXISTENCE_TYPE__CHECK_DATABASE = EXISTENCE_TYPE_ + "CHECK_DATABASE";
- String EXISTENCE_TYPE__ASSUME_EXISTENCE = EXISTENCE_TYPE_ + "ASSUME_EXISTENCE";
- String EXISTENCE_TYPE__ASSUME_NON_EXISTENCE = EXISTENCE_TYPE_ + "ASSUME_NON_EXISTENCE";
-
String JOIN_FETCH = PACKAGE_ + "JoinFetch";
- String JOIN_FETCH_VALUE = "value";
-
- String JOIN_FETCH_TYPE = PACKAGE_ + "JoinFetchType";
- String JOIN_FETCH_TYPE_ = JOIN_FETCH_TYPE + ".";
- String JOIN_FETCH_TYPE__INNER = JOIN_FETCH_TYPE_ + "INNER";
- String JOIN_FETCH_TYPE__OUTER = JOIN_FETCH_TYPE_ + "OUTER";
-
+ String JOIN_FETCH__VALUE = "value";
String MUTABLE = PACKAGE_ + "Mutable";
String MUTABLE__VALUE = "value";
-
String OBJECT_TYPE_CONVERTER = PACKAGE_ + "ObjectTypeConverter";
String OBJECT_TYPE_CONVERTER__NAME = "name";
- String OBJECT_TYPE_CONVERTER__DATE_TYPE = "dataType";
+ String OBJECT_TYPE_CONVERTER__DATA_TYPE = "dataType";
String OBJECT_TYPE_CONVERTER__OBJECT_TYPE = "objectType";
String OBJECT_TYPE_CONVERTER__CONVERSION_VALUES = "conversionValues";
String OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE = "defaultObjectValue";
-
String PRIVATE_OWNED = PACKAGE_ + "PrivateOwned";
-
String READ_ONLY = PACKAGE_ + "ReadOnly";
-
String READ_TRANSFORMER = PACKAGE_ + "ReadTransformer";
String READ_TRANSFORMER__TRANSFORMER_CLASS = "transformerClass";
String READ_TRANSFORMER__METHOD = "method";
-
String STRUCT_CONVERTER = PACKAGE_ + "StructConverter";
String STRUCT_CONVERTER__NAME = "name";
String STRUCT_CONVERTER__CONVERTER = "converter";
-
String TIME_OF_DAY = PACKAGE_ + "TimeOfDay";
String TIME_OF_DAY__HOUR = "hour";
String TIME_OF_DAY__MINUTE = "minute";
String TIME_OF_DAY__SECOND = "second";
String TIME_OF_DAY__MILLISECOND = "millisecond";
-
String TRANSFORMATION = PACKAGE_ + "Transformation";
String TRANSFORMATION__FETCH = "fetch";
String TRANSFORMATION__OPTIONAL = "optional";
-
String TYPE_CONVERTER = PACKAGE_ + "TypeConverter";
String TYPE_CONVERTER__NAME = "name";
- String TYPE_CONVERTER__DATE_TYPE = "dataType";
+ String TYPE_CONVERTER__DATA_TYPE = "dataType";
String TYPE_CONVERTER__OBJECT_TYPE = "objectType";
-
String VARIABLE_ONE_TO_ONE = PACKAGE_ + "VariableOneToOne";
-
String WRITE_TRANSFORMER = PACKAGE_ + "WriteTransformer";
String WRITE_TRANSFORMER__TRANSFORMER_CLASS = "transformerClass";
String WRITE_TRANSFORMER__METHOD = "method";
String WRITE_TRANSFORMER__COLUMN = "column";
-
String WRITE_TRANSFORMERS = PACKAGE_ + "WriteTransformers";
String WRITE_TRANSFORMERS__VALUE = "value";
+ // EclipseLink enums
+ String CACHE_COORDINATION_TYPE = PACKAGE_ + "CacheCoordinationType";
+ String CACHE_COORDINATION_TYPE_ = CACHE_COORDINATION_TYPE + ".";
+ String CACHE_COORDINATION_TYPE__SEND_OBJECT_CHANGES = CACHE_COORDINATION_TYPE_ + "SEND_OBJECT_CHANGES";
+ String CACHE_COORDINATION_TYPE__INVALIDATE_CHANGED_OBJECTS = CACHE_COORDINATION_TYPE_ + "INVALIDATE_CHANGED_OBJECTS";
+ String CACHE_COORDINATION_TYPE__SEND_NEW_OBJECTS_WITH_CHANGES = CACHE_COORDINATION_TYPE_ + "SEND_NEW_OBJECTS_WITH_CHANGES";
+ String CACHE_COORDINATION_TYPE__NONE = CACHE_COORDINATION_TYPE_ + "NONE";
+ String CACHE_TYPE = PACKAGE_ + "CacheType";
+ String CACHE_TYPE_ = CACHE_TYPE + ".";
+ String CACHE_TYPE__FULL = CACHE_TYPE_ + "FULL";
+ String CACHE_TYPE__WEAK = CACHE_TYPE_ + "WEAK";
+ String CACHE_TYPE__SOFT = CACHE_TYPE_ + "SOFT";
+ String CACHE_TYPE__SOFT_WEAK = CACHE_TYPE_ + "SOFT_WEAK";
+ String CACHE_TYPE__HARD_WEAK = CACHE_TYPE_ + "HARD_WEAK";
+ String CACHE_TYPE__CACHE = CACHE_TYPE_ + "CACHE";
+ String CACHE_TYPE__NONE = CACHE_TYPE_ + "NONE";
+ String CHANGE_TRACKING_TYPE = PACKAGE_ + "ChangeTrackingType";
+ String CHANGE_TRACKING_TYPE_ = CHANGE_TRACKING_TYPE + ".";
+ String CHANGE_TRACKING_TYPE__ATTRIBUTE = CHANGE_TRACKING_TYPE_ + "ATTRIBUTE";
+ String CHANGE_TRACKING_TYPE__OBJECT = CHANGE_TRACKING_TYPE_ + "OBJECT";
+ String CHANGE_TRACKING_TYPE__DEFERRED = CHANGE_TRACKING_TYPE_ + "DEFERRED";
+ String CHANGE_TRACKING_TYPE__AUTO = CHANGE_TRACKING_TYPE_ + "AUTO";
+ String EXISTENCE_TYPE = PACKAGE_ + "ExistenceType";
+ String EXISTENCE_TYPE_ = EXISTENCE_TYPE + ".";
+ String EXISTENCE_TYPE__CHECK_CACHE = EXISTENCE_TYPE_ + "CHECK_CACHE";
+ String EXISTENCE_TYPE__CHECK_DATABASE = EXISTENCE_TYPE_ + "CHECK_DATABASE";
+ String EXISTENCE_TYPE__ASSUME_EXISTENCE = EXISTENCE_TYPE_ + "ASSUME_EXISTENCE";
+ String EXISTENCE_TYPE__ASSUME_NON_EXISTENCE = EXISTENCE_TYPE_ + "ASSUME_NON_EXISTENCE";
+ String JOIN_FETCH_TYPE = PACKAGE_ + "JoinFetchType";
+ String JOIN_FETCH_TYPE_ = JOIN_FETCH_TYPE + ".";
+ String JOIN_FETCH_TYPE__INNER = JOIN_FETCH_TYPE_ + "INNER";
+ String JOIN_FETCH_TYPE__OUTER = JOIN_FETCH_TYPE_ + "OUTER";
+
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/JoinFetchAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/JoinFetchAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 JoinFetchAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/JoinFetchAnnotation.java 29 Sep 2008 21:47:24 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/JoinFetchAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Resource model interface that represents the
- * org.eclipse.persistence.annotations.JoinFetch annotation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.JoinFetch
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,30 +26,28 @@
* @version 2.1
* @since 2.1
*/
-public interface JoinFetchAnnotation extends JavaResourceNode
+public interface JoinFetchAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.JOIN_FETCH;
-
+
/**
- * Corresponds to the value element of the JoinFetch annotation.
- * Returns null if the value element does not exist in java.
+ * Corresponds to the 'value' element of the JoinFetch annotation.
+ * Return null if the element does not exist in Java.
*/
JoinFetchType getValue();
-
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
/**
- * Corresponds to the value element of the JoinFetch annotation.
- * Set to null to remove the value element.
+ * Corresponds to the 'value' element of the JoinFetch annotation.
+ * Set to null to remove the element.
*/
void setValue(JoinFetchType value);
- String VALUE_PROPERTY = "valueProperty"; //$NON-NLS-1$
-
-
+
/**
- * Return the {@link TextRange} for the value element. If the value element
+ * Return the {@link TextRange} for the 'value' element. If the element
* does not exist return the {@link TextRange} for the JoinFetch annotation.
*/
TextRange getValueTextRange(CompilationUnit astRoot);
-
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/ExistenceCheckingAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/ExistenceCheckingAnnotation.java,v
retrieving revision 1.3
diff -u -r1.3 ExistenceCheckingAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/ExistenceCheckingAnnotation.java 29 Sep 2008 21:47:23 -0000 1.3
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/ExistenceCheckingAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Resource model interface that represents the
- * org.eclipse.persistence.annotations.ExistenceChecking annotation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.ExistenceChecking
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,30 +26,28 @@
* @version 2.1
* @since 2.1
*/
-public interface ExistenceCheckingAnnotation extends JavaResourceNode
+public interface ExistenceCheckingAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.EXISTENCE_CHECKING;
-
+
/**
- * Corresponds to the value element of the ExistenceChecking annotation.
- * Returns null if the value element does not exist in java.
+ * Corresponds to the 'value' element of the ExistenceChecking annotation.
+ * Return null if the element does not exist in Java.
*/
ExistenceType getValue();
-
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
/**
- * Corresponds to the value element of the ExistenceChecking annotation.
- * Set to null to remove the value element.
+ * Corresponds to the 'value' element of the ExistenceChecking annotation.
+ * Set to null to remove the element.
*/
void setValue(ExistenceType value);
- String VALUE_PROPERTY = "valueProperty"; //$NON-NLS-1$
-
-
+
/**
- * Return the {@link TextRange} for the value element. If the value element
+ * Return the {@link TextRange} for the 'value' element. If the element
* does not exist return the {@link TextRange} for the ExistenceChecking annotation.
*/
TextRange getValueTextRange(CompilationUnit astRoot);
-
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/ObjectTypeConverterAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/ObjectTypeConverterAnnotation.java,v
retrieving revision 1.3
diff -u -r1.3 ObjectTypeConverterAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/ObjectTypeConverterAnnotation.java 29 Oct 2008 21:29:03 -0000 1.3
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/ObjectTypeConverterAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -14,8 +14,8 @@
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.ObjectTypeConverter
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,46 +26,66 @@
* @version 2.1
* @since 2.1
*/
-public interface ObjectTypeConverterAnnotation extends TypeConverterAnnotation
+public interface ObjectTypeConverterAnnotation
+ extends BaseTypeConverterAnnotation
{
String ANNOTATION_NAME = EclipseLinkJPA.OBJECT_TYPE_CONVERTER;
/**
- * Corresponds to the conversionValues element of the ObjectTypeConverter annotation.
- * Returns an empty iterator if the conversionValues element does not exist in java.
+ * Corresponds to the 'conversionValues' element of the ObjectTypeConverter annotation.
+ * Return an empty iterator if the element does not exist in Java.
*/
ListIterator conversionValues();
+ String CONVERSION_VALUES_LIST = "conversionValues"; //$NON-NLS-1$
+ /**
+ * Corresponds to the 'conversionValues' element of the ObjectTypeConverter annotation.
+ */
+ int conversionValuesSize();
+
+ /**
+ * Corresponds to the 'conversionValues' element of the ObjectTypeConverter annotation.
+ */
ConversionValueAnnotation conversionValueAt(int index);
+ /**
+ * Corresponds to the 'conversionValues' element of the ObjectTypeConverter annotation.
+ */
int indexOfConversionValue(ConversionValueAnnotation conversionValue);
- int conversionValuesSize();
-
+ /**
+ * Corresponds to the 'conversionValues' element of the ObjectTypeConverter annotation.
+ */
ConversionValueAnnotation addConversionValue(int index);
- void removeConversionValue(int index);
-
+ /**
+ * Corresponds to the 'conversionValues' element of the ObjectTypeConverter annotation.
+ */
void moveConversionValue(int targetIndex, int sourceIndex);
- String CONVERSION_VALUES_LIST = "conversionValuesList"; //$NON-NLS-1$
-
/**
- * Corresponds to the defaultObjectValue element of the ObjectTypeConverter annotation.
- * Returns null if the defaultObjectValue element does not exist in java.
+ * Corresponds to the 'conversionValues' element of the ObjectTypeConverter annotation.
*/
- String getDefaultObjectValue();
+ void removeConversionValue(int index);
+
/**
- * Corresponds to the defaultObjectValue element of the ObjectTypeConverter annotation.
- * Set to null to remove the defaultObjectValue element.
+ * Corresponds to the 'defaultObjectValue' element of the ObjectTypeConverter annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getDefaultObjectValue();
+ String DEFAULT_OBJECT_VALUE_PROPERTY = "defaultObjectValue"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'defaultObjectValue' element of the ObjectTypeConverter annotation.
+ * Set to null to remove the element.
*/
void setDefaultObjectValue(String value);
- String DEFAULT_OBJECT_VALUE_PROPERTY = "defaultObjectValueProperty"; //$NON-NLS-1$
-
+
/**
- * Return the {@link TextRange} for the defaultObjectValue element. If the defaultObjectValue element
+ * Return the {@link TextRange} for the 'defaultObjectValue' element. If the element
* does not exist return the {@link TextRange} for the ObjectTypeConverter annotation.
*/
TextRange getDefaultObjectValueTextRange(CompilationUnit astRoot);
+
}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/MutableAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/MutableAnnotation.java,v
retrieving revision 1.2
diff -u -r1.2 MutableAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/MutableAnnotation.java 29 Sep 2008 21:47:24 -0000 1.2
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/MutableAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Java resource model interface that corresponds to the Eclipselink
- * annotation org.eclipse.persistence.annotations.Mutable
+ * Corresponds to the Eclipselink annotation
+ * org.eclipse.persistence.annotations.Mutable
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,27 +26,26 @@
* @version 2.1
* @since 2.1
*/
-public interface MutableAnnotation extends JavaResourceNode
+public interface MutableAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.MUTABLE;
-
/**
- * Corresponds to the value element of the Mutable annotation.
- * Returns null if the value element does not exist in java.
+ * Corresponds to the 'value' element of the Mutable annotation.
+ * Return null if the element does not exist in Java.
*/
Boolean getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
/**
- * Corresponds to the value element of the Mutable annotation.
- * Set to null to remove the value element.
+ * Corresponds to the 'value' element of the Mutable annotation.
+ * Set to null to remove the element.
*/
void setValue(Boolean value);
- String VALUE_PROPERTY = "valueProperty"; //$NON-NLS-1$
/**
- * Return the {@link TextRange} for the value element. If the value element
+ * Return the {@link TextRange} for the 'value' element. If the element
* does not exist return the {@link TextRange} for the Mutable annotation.
*/
TextRange getValueTextRange(CompilationUnit astRoot);
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/CacheAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/CacheAnnotation.java,v
retrieving revision 1.4
diff -u -r1.4 CacheAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/CacheAnnotation.java 29 Sep 2008 21:47:24 -0000 1.4
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/CacheAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.eclipselink.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.utility.TextRange;
/**
- * Resource model interface that represents the
- * org.eclipse.persistence.annotations.Cache annotation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.Cache
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -26,173 +26,194 @@
* @version 2.1
* @since 2.1
*/
-public interface CacheAnnotation extends JavaResourceNode
+public interface CacheAnnotation
+ extends Annotation
{
-
String ANNOTATION_NAME = EclipseLinkJPA.CACHE;
-
+
/**
- * Corresponds to the type element of the Cache annotation.
- * Returns null if the type element does not exist in java.
+ * Corresponds to the 'type' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
CacheType getType();
+ String TYPE_PROPERTY = "type"; //$NON-NLS-1$
/**
- * Corresponds to the type element of the Cache annotation.
- * Set to null to remove the type element.
+ * Corresponds to the 'type' element of the Cache annotation.
+ * Set to null to remove the element.
*/
void setType(CacheType type);
- String TYPE_PROPERTY = "typeProperty"; //$NON-NLS-1$
/**
- * Corresponds to the size element of the Cache annotation.
- * Returns null if the size valuePair does not exist in the annotation
+ * Return the {@link TextRange} for the 'type' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
+ */
+ TextRange getTypeTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'size' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
Integer getSize();
+ String SIZE_PROPERTY = "size"; //$NON-NLS-1$
/**
- * Corresponds to the size element of the Cache annotation.
- * Set to null to remove the size valuePair from the annotation
+ * Corresponds to the 'size' element of the Cache annotation.
+ * Set to null to remove the element.
*/
void setSize(Integer size);
- String SIZE_PROPERTY = "sizeProperty"; //$NON-NLS-1$
/**
- * Corresponds to the shared element of the Cache annotation.
- * Returns null if the shared element does not exist in java.
+ * Return the {@link TextRange} for the 'size' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
+ */
+ TextRange getSizeTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'shared' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
Boolean getShared();
+ String SHARED_PROPERTY = "shared"; //$NON-NLS-1$
/**
- * Corresponds to the shared element of the Cache annotation.
- * Set to null to remove the shared element.
+ * Corresponds to the 'shared' element of the Cache annotation.
+ * Set to null to remove the element.
*/
void setShared(Boolean shared);
- String SHARED_PROPERTY = "sharedProperty"; //$NON-NLS-1$
-
/**
- * Corresponds to the expiry element of the Cache annotation.
- * Returns null if the expiry valuePair does not exist in the annotation
+ * Return the {@link TextRange} for the 'shared' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
+ */
+ TextRange getSharedTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'expiry' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
Integer getExpiry();
+ String EXPIRY_PROPERTY = "expiry"; //$NON-NLS-1$
/**
- * Corresponds to the expiry element of the Cache annotation.
- * Set to null to remove the expiry valuePair from the annotation
+ * Corresponds to the 'expiry' element of the Cache annotation.
+ * Set to null to remove the element.
*/
void setExpiry(Integer expiry);
- String EXPIRY_PROPERTY = "expiryProperty"; //$NON-NLS-1$
- TimeOfDayAnnotation addExpiryTimeOfDay();
- void removeExpiryTimeOfDay();
- TimeOfDayAnnotation getExpiryTimeOfDay();
- String EXPIRY_TIME_OF_DAY_PROPERTY = "expiryTimeOfDayProperty"; //$NON-NLS-1$
-
/**
- * Corresponds to the alwaysRefresh element of the Cache annotation.
- * Returns null if the alwaysRefresh element does not exist in java.
+ * Return the {@link TextRange} for the 'expiry' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
*/
- Boolean getAlwaysRefresh();
+ TextRange getExpiryTextRange(CompilationUnit astRoot);
+
/**
- * Corresponds to the alwaysRefresh element of the Cache annotation.
- * Set to null to remove the alwaysRefresh element.
+ * Corresponds to the 'expiryTimeOfDay' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
- void setAlwaysRefresh(Boolean alwaysRefresh);
- String ALWAYS_REFRESH_PROPERTY = "alwaysRefreshProperty"; //$NON-NLS-1$
+ TimeOfDayAnnotation getExpiryTimeOfDay();
+ String EXPIRY_TIME_OF_DAY_PROPERTY = "expiryTimeOfDay"; //$NON-NLS-1$
+
+ TimeOfDayAnnotation addExpiryTimeOfDay();
+
+ void removeExpiryTimeOfDay();
/**
- * Corresponds to the refreshOnlyIfNewer element of the Cache annotation.
- * Returns null if the refreshOnlyIfNewer element does not exist in java.
+ * Return the {@link TextRange} for the 'expiryTimeOfDay' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
*/
- Boolean getRefreshOnlyIfNewer();
+ TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot);
+
/**
- * Corresponds to the refreshOnlyIfNewer element of the Cache annotation.
- * Set to null to remove the refreshOnlyIfNewer element.
- */
- void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer);
- String REFRESH_ONLY_IF_NEWER_PROPERTY = "refreshOnlyIfNewerProperty"; //$NON-NLS-1$
-
- /**
- * Corresponds to the disableHits element of the Cache annotation.
- * Returns null if the disableHits element does not exist in java.
+ * Corresponds to the 'alwaysRefresh' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
- Boolean getDisableHits();
+ Boolean getAlwaysRefresh();
+ String ALWAYS_REFRESH_PROPERTY = "alwaysRefresh"; //$NON-NLS-1$
/**
- * Corresponds to the disableHits element of the Cache annotation.
- * Set to null to remove the disableHits element.
+ * Corresponds to the 'alwaysRefresh' element of the Cache annotation.
+ * Set to null to remove the element.
*/
- void setDisableHits(Boolean disableHits);
- String DISABLE_HITS_PROPERTY = "disableHitsProperty"; //$NON-NLS-1$
+ void setAlwaysRefresh(Boolean alwaysRefresh);
/**
- * Corresponds to the type element of the Cache annotation.
- * Returns null if the type element does not exist in java.
+ * Return the {@link TextRange} for the 'alwaysRefresh' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
*/
- CacheCoordinationType getCoordinationType();
+ TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot);
- /**
- * Corresponds to the type element of the Cache annotation.
- * Set to null to remove the type element.
- */
- void setCoordinationType(CacheCoordinationType coordinationType);
- String COORDINATION_TYPE_PROPERTY = "coordinationTypeProperty"; //$NON-NLS-1$
-
/**
- * Return the {@link TextRange} for the type element. If the type element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Corresponds to the 'refreshOnlyIfNewer' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
- TextRange getTypeTextRange(CompilationUnit astRoot);
+ Boolean getRefreshOnlyIfNewer();
+ String REFRESH_ONLY_IF_NEWER_PROPERTY = "refreshOnlyIfNewer"; //$NON-NLS-1$
/**
- * Return the {@link TextRange} for the shared element. If the shared element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Corresponds to the 'refreshOnlyIfNewer' element of the Cache annotation.
+ * Set to null to remove the element.
*/
- TextRange getSizeTextRange(CompilationUnit astRoot);
-
+ void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer);
+
/**
- * Return the {@link TextRange} for the shared element. If the shared element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Return the {@link TextRange} for the 'refreshOnlyIfNewer' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
*/
- TextRange getSharedTextRange(CompilationUnit astRoot);
+ TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot);
+
/**
- * Return the {@link TextRange} for the expiry element. If the expiry element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Corresponds to the 'disableHits' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
- TextRange getExpiryTextRange(CompilationUnit astRoot);
+ Boolean getDisableHits();
+ String DISABLE_HITS_PROPERTY = "disableHits"; //$NON-NLS-1$
/**
- * Return the {@link TextRange} for the expiryTimeOfDay element. If the expiryTimeOfDay element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Corresponds to the 'disableHits' element of the Cache annotation.
+ * Set to null to remove the element.
*/
- TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot);
-
+ void setDisableHits(Boolean disableHits);
+
/**
- * Return the {@link TextRange} for the alwaysRefresh element. If the alwaysRefresh element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Return the {@link TextRange} for the 'disableHits' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
*/
- TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot);
+ TextRange getDisablesHitsTextRange(CompilationUnit astRoot);
+
/**
- * Return the {@link TextRange} for the refreshOnlyIfNewer element. If the refreshOnlyIfNewer element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Corresponds to the 'coordinationType' element of the Cache annotation.
+ * Return null if the element does not exist in Java.
*/
- TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot);
+ CacheCoordinationType getCoordinationType();
+ String COORDINATION_TYPE_PROPERTY = "coordinationType"; //$NON-NLS-1$
/**
- * Return the {@link TextRange} for the disableHits element. If the disableHits element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Corresponds to the 'coordinationType' element of the Cache annotation.
+ * Set to null to remove the element.
*/
- TextRange getDisablesHitsTextRange(CompilationUnit astRoot);
-
+ void setCoordinationType(CacheCoordinationType coordinationType);
+
/**
- * Return the {@link TextRange} for the coordinationType element. If the coordinationType element
- * does not exist return the {@link TextRange} for the Cache annotation.
+ * Return the {@link TextRange} for the 'coordinationType' element.
+ * If the element does not exist return the {@link TextRange}
+ * for the Cache annotation.
*/
TextRange getCoordinationTypeTextRange(CompilationUnit astRoot);
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/PrivateOwnedAnnotation.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/resource/java/PrivateOwnedAnnotation.java,v
retrieving revision 1.1
diff -u -r1.1 PrivateOwnedAnnotation.java
--- src/org/eclipse/jpt/eclipselink/core/resource/java/PrivateOwnedAnnotation.java 26 Sep 2008 19:34:14 -0000 1.1
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/PrivateOwnedAnnotation.java 8 Apr 2009 15:52:03 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -9,11 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.resource.java;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.Annotation;
/**
- * Resource model interface that represents the
- * org.eclipse.persistence.annotations.PrivateOwned annotation
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.PrivateOwned
*
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -24,8 +24,8 @@
* @version 2.1
* @since 2.1
*/
-public interface PrivateOwnedAnnotation extends JavaResourceNode
+public interface PrivateOwnedAnnotation
+ extends Annotation
{
String ANNOTATION_NAME = EclipseLinkJPA.PRIVATE_OWNED;
-
}
Index: src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java,v
retrieving revision 1.1
diff -u -r1.1 EclipseLinkJpaAnnotationDefinitionProvider.java
--- src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java 15 Jan 2009 17:59:32 -0000 1.1
+++ src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java 8 Apr 2009 15:52:03 -0000
@@ -13,25 +13,25 @@
import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
import org.eclipse.jpt.core.internal.platform.AbstractJpaAnnotationDefintionProvider;
import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.BasicCollectionImpl.BasicCollectionAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.BasicMapImpl.BasicMapAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.CacheImpl.CacheAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.ChangeTrackingImpl.ChangeTrackingAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.ConvertImpl.ConvertAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.ConverterImpl.ConverterAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.CustomizerImpl.CustomizerAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.ExistenceCheckingImpl.ExistenceCheckingAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.JoinFetchImpl.JoinFetchAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.MutableImpl.MutableAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.ObjectTypeConverterImpl.ObjectTypeConverterAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.PrivateOwnedImpl.PrivateOwnedAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.ReadOnlyImpl.ReadOnlyAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.ReadTransformerImpl.ReadTransformerAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.StructConverterImpl.StructConverterAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.TransformationImpl.TransformationAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.TypeConverterImpl.TypeConverterAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.VariableOneToOneImpl.VariableOneToOneAnnotationDefinition;
-import org.eclipse.jpt.eclipselink.core.internal.resource.java.WriteTransformerImpl.WriteTransformerAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.BasicCollectionAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.BasicMapAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.CacheAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.ChangeTrackingAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.ConvertAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.ConverterAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.CustomizerAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.ExistenceCheckingAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.JoinFetchAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.MutableAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.ObjectTypeConverterAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.PrivateOwnedAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.ReadOnlyAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.ReadTransformerAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.StructConverterAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.TransformationAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.TypeConverterAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.VariableOneToOneAnnotationDefinition;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.WriteTransformerAnnotationDefinition;
/**
* Provides annotations for 1.0 EclipseLink platform which includes JPA annotations and
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.eclipselink.core/META-INF/MANIFEST.MF,v
retrieving revision 1.26
diff -u -r1.26 MANIFEST.MF
--- META-INF/MANIFEST.MF 12 Feb 2009 23:14:33 -0000 1.26
+++ META-INF/MANIFEST.MF 8 Apr 2009 15:52:03 -0000
@@ -46,11 +46,13 @@
org.eclipse.jpt.eclipselink.core.internal.ddlgen;x-internal:=true,
org.eclipse.jpt.eclipselink.core.internal.operations;x-internal:=true,
org.eclipse.jpt.eclipselink.core.internal.resource.java;x-internal:=true,
+ org.eclipse.jpt.eclipselink.core.internal.resource.java.binary;x-internal:=true,
+ org.eclipse.jpt.eclipselink.core.internal.resource.java.source;x-internal:=true,
org.eclipse.jpt.eclipselink.core.internal.resource.orm;x-internal:=true,
org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators;x-internal:=true,
org.eclipse.jpt.eclipselink.core.resource.java,
org.eclipse.jpt.eclipselink.core.resource.orm,
- org.eclipse.jpt.eclipselink1_1.core.internal.resource.orm.translators,
+ org.eclipse.jpt.eclipselink1_1.core.internal.resource.orm.translators;x-internal:=true,
org.eclipse.jpt.eclipselink1_1.core.resource.orm,
org.eclipse.jpt.eclipselink1_1.core.resource.orm.util
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryObjectTypeConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceObjectTypeConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ */
+public class ObjectTypeConverterAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ObjectTypeConverterAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ObjectTypeConverterAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceObjectTypeConverterAnnotation(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryObjectTypeConverterAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ObjectTypeConverterAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryVariableOneToOneAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryVariableOneToOneAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryVariableOneToOneAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryVariableOneToOneAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.eclipselink.core.resource.java.VariableOneToOneAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.VariableOneToOne
+ */
+public class BinaryVariableOneToOneAnnotation
+ extends BinaryAnnotation
+ implements VariableOneToOneAnnotation
+{
+ public BinaryVariableOneToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceExistenceCheckingAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceExistenceCheckingAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceExistenceCheckingAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceExistenceCheckingAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType;
+
+/**
+ * org.eclipse.persistence.annotations.ExistenceChecking
+ */
+public final class SourceExistenceCheckingAnnotation
+ extends SourceAnnotation
+ implements ExistenceCheckingAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter valueAdapter;
+ private ExistenceType value;
+
+
+ public SourceExistenceCheckingAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** ExistenceCheckingAnnotation implementation **********
+
+ // ***** value
+ public ExistenceType getValue() {
+ return this.value;
+ }
+
+ public void setValue(ExistenceType value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ ExistenceType old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(ExistenceType.toJavaAnnotationValue(value));
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private ExistenceType buildValue(CompilationUnit astRoot) {
+ return ExistenceType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildValueAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.EXISTENCE_CHECKING__VALUE, false);
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformationAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformationAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformationAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformationAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.core.resource.java.FetchType;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Transformation
+ */
+public class NullTransformationAnnotation
+ extends NullAnnotation
+ implements TransformationAnnotation
+{
+ protected NullTransformationAnnotation(JavaResourcePersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ protected TransformationAnnotation buildMappingAnnotation() {
+ return (TransformationAnnotation) super.buildMappingAnnotation();
+ }
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return null;
+ }
+
+ public void setFetch(FetchType fetch) {
+ if (fetch != null) {
+ this.buildMappingAnnotation().setFetch(fetch);
+ }
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ // ***** optional
+ public Boolean getOptional() {
+ return null;
+ }
+
+ public void setOptional(Boolean optional) {
+ if (optional != null) {
+ this.buildMappingAnnotation().setOptional(optional);
+ }
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBaseTypeConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBaseTypeConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBaseTypeConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBaseTypeConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.BaseTypeConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ * org.eclipse.persistence.annotations.TypeConverter
+ */
+abstract class BinaryBaseTypeConverterAnnotation
+ extends BinaryNamedConverterAnnotation
+ implements BaseTypeConverterAnnotation
+{
+ String dataType;
+ String objectType;
+
+
+ BinaryBaseTypeConverterAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.dataType = this.buildDataType();
+ this.objectType = this.buildObjectType();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDataType_(this.buildDataType());
+ this.setObjectType_(this.buildObjectType());
+ }
+
+
+ // ********** ObjectTypeConverterAnnotation implementation **********
+
+ // ***** data type
+ public String getDataType() {
+ return this.dataType;
+ }
+
+ public void setDataType(String dataType) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDataType_(String dataType) {
+ String old = this.dataType;
+ this.dataType = dataType;
+ this.firePropertyChanged(DATA_TYPE_PROPERTY, old, dataType);
+ }
+
+ private String buildDataType() {
+ return (String) this.getJdtMemberValue(this.getDataTypeElementName());
+ }
+
+ public TextRange getDataTypeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ abstract String getDataTypeElementName();
+
+ // ***** object type
+ public String getObjectType() {
+ return this.objectType;
+ }
+
+ public void setObjectType(String objectType) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setObjectType_(String objectType) {
+ String old = this.objectType;
+ this.objectType = objectType;
+ this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, objectType);
+ }
+
+ private String buildObjectType() {
+ return (String) this.getJdtMemberValue(this.getObjectTypeElementName());
+ }
+
+ public TextRange getObjectTypeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ abstract String getObjectTypeElementName();
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryStructConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryStructConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryStructConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryStructConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.StructConverter
+ */
+public final class BinaryStructConverterAnnotation
+ extends BinaryNamedConverterAnnotation
+ implements StructConverterAnnotation
+{
+ private String converter;
+
+
+ public BinaryStructConverterAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.converter = this.buildConverter();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setConverter_(this.buildConverter());
+ }
+
+
+ // ********** BinaryNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.STRUCT_CONVERTER__NAME;
+ }
+
+
+ // ********** StructConverterAnnotation implementation **********
+
+ // ***** converter
+ public String getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(String converter) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setConverter_(String converter) {
+ String old = this.converter;
+ this.converter = converter;
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ private String buildConverter() {
+ return (String) this.getJdtMemberValue(EclipseLinkJPA.STRUCT_CONVERTER__CONVERTER);
+ }
+
+ public TextRange getConverterTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryCustomizerAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceCustomizerAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Customizer
+ */
+public class CustomizerAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new CustomizerAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private CustomizerAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceCustomizerAnnotation(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryCustomizerAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return CustomizerAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicCollectionAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicCollectionAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicCollectionAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicCollectionAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.BasicCollection
+ */
+public final class BinaryBasicCollectionAnnotation
+ extends BinaryAnnotation
+ implements BasicCollectionAnnotation
+{
+ public BinaryBasicCollectionAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourcePrivateOwnedAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourcePrivateOwnedAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourcePrivateOwnedAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourcePrivateOwnedAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.PrivateOwned
+ */
+public final class SourcePrivateOwnedAnnotation
+ extends SourceAnnotation
+ implements PrivateOwnedAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourcePrivateOwnedAnnotation(JavaResourceNode parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void update(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Converter
+ */
+public class ConverterAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ConverterAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ConverterAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceConverterAnnotation(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryConverterAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ConverterAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTimeOfDayAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTimeOfDayAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTimeOfDayAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTimeOfDayAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.TimeOfDay
+ */
+public final class BinaryTimeOfDayAnnotation
+ extends BinaryAnnotation
+ implements TimeOfDayAnnotation
+{
+ private Integer hour;
+ private Integer minute;
+ private Integer second;
+ private Integer millisecond;
+
+
+ public BinaryTimeOfDayAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.hour = this.buildHour();
+ this.minute = this.buildMinute();
+ this.second = this.buildSecond();
+ this.millisecond = this.buildMillisecond();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setHour_(this.buildHour());
+ this.setMinute_(this.buildMinute());
+ this.setSecond_(this.buildSecond());
+ this.setMillisecond_(this.buildMillisecond());
+ }
+
+
+ // ********** TimeOfDayAnnotation implementation **********
+
+ // ***** hour
+ public Integer getHour() {
+ return this.hour;
+ }
+
+ public void setHour(Integer hour) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setHour_(Integer hour) {
+ Integer old = this.hour;
+ this.hour = hour;
+ this.firePropertyChanged(HOUR_PROPERTY, old, hour);
+ }
+
+ private Integer buildHour() {
+ return (Integer) this.getJdtMemberValue(EclipseLinkJPA.TIME_OF_DAY__HOUR);
+ }
+
+ public TextRange getHourTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** minute
+ public Integer getMinute() {
+ return this.minute;
+ }
+
+ public void setMinute(Integer newMinute) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setMinute_(Integer newMinute) {
+ Integer oldMinute = this.minute;
+ this.minute = newMinute;
+ this.firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute);
+ }
+
+ private Integer buildMinute() {
+ return (Integer) this.getJdtMemberValue(EclipseLinkJPA.TIME_OF_DAY__MINUTE);
+ }
+
+ public TextRange getMinuteTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** second
+ public Integer getSecond() {
+ return this.second;
+ }
+
+ public void setSecond(Integer newSecond) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setSecond_(Integer newSecond) {
+ Integer oldSecond = this.second;
+ this.second = newSecond;
+ this.firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond);
+ }
+
+ private Integer buildSecond() {
+ return (Integer) this.getJdtMemberValue(EclipseLinkJPA.TIME_OF_DAY__SECOND);
+ }
+
+ public TextRange getSecondTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** millisecond
+ public Integer getMillisecond() {
+ return this.millisecond;
+ }
+
+ public void setMillisecond(Integer newMillisecond) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setMillisecond_(Integer newMillisecond) {
+ Integer oldMillisecond = this.millisecond;
+ this.millisecond = newMillisecond;
+ this.firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond);
+ }
+
+ private Integer buildMillisecond() {
+ return (Integer) this.getJdtMemberValue(EclipseLinkJPA.TIME_OF_DAY__MILLISECOND);
+ }
+
+ public TextRange getMillisecondTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadOnlyAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadOnlyAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadOnlyAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadOnlyAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadOnly
+ */
+public final class SourceReadOnlyAnnotation
+ extends SourceAnnotation
+ implements ReadOnlyAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceReadOnlyAnnotation(JavaResourceNode parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void update(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadOnlyAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadOnlyAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadOnlyAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadOnlyAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadOnly
+ */
+public final class BinaryReadOnlyAnnotation
+ extends BinaryAnnotation
+ implements ReadOnlyAnnotation
+{
+
+ public BinaryReadOnlyAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceObjectTypeConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceObjectTypeConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceObjectTypeConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceObjectTypeConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.NestableConversionValueAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+/**
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ */
+public final class SourceObjectTypeConverterAnnotation
+ extends SourceBaseTypeConverterAnnotation
+ implements ObjectTypeConverterAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter DEFAULT_OBJECT_VALUE_ADAPTER = buildDefaultObjectValueAdapter();
+ private final AnnotationElementAdapter defaultObjectValueAdapter;
+ private String defaultObjectValue;
+
+ private final Vector conversionValues = new Vector();
+ private final ConversionValuesAnnotationContainer conversionValuesContainer = new ConversionValuesAnnotationContainer();
+
+
+ public SourceObjectTypeConverterAnnotation(JavaResourcePersistentMember parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.defaultObjectValueAdapter = new ShortCircuitAnnotationElementAdapter(member, DEFAULT_OBJECT_VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.defaultObjectValue = this.buildDefaultObjectValue(astRoot);
+ AnnotationContainerTools.initialize(this.conversionValuesContainer, astRoot);
+ }
+
+ @Override
+ public void update(CompilationUnit astRoot) {
+ super.update(astRoot);
+ this.setDefaultObjectValue(this.buildDefaultObjectValue(astRoot));
+ AnnotationContainerTools.update(this.conversionValuesContainer, astRoot);
+ }
+
+
+ // ********** SourceNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__NAME;
+ }
+
+
+ // ********** SourceBaseTypeConverterAnnotation implementation **********
+
+ @Override
+ String getDataTypeElementName() {
+ return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DATA_TYPE;
+ }
+
+ @Override
+ String getObjectTypeElementName() {
+ return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__OBJECT_TYPE;
+ }
+
+
+ // ********** ObjectTypeConverterAnnotation implementation **********
+
+ // ***** default object value
+ public String getDefaultObjectValue() {
+ return this.defaultObjectValue;
+ }
+
+ public void setDefaultObjectValue(String defaultObjectValue) {
+ if (this.attributeValueHasNotChanged(this.defaultObjectValue, defaultObjectValue)) {
+ return;
+ }
+ String old = this.defaultObjectValue;
+ this.defaultObjectValue = defaultObjectValue;
+ this.defaultObjectValueAdapter.setValue(defaultObjectValue);
+ this.firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, old, defaultObjectValue);
+ }
+
+ private String buildDefaultObjectValue(CompilationUnit astRoot) {
+ return this.defaultObjectValueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getDefaultObjectValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(DEFAULT_OBJECT_VALUE_ADAPTER, astRoot);
+ }
+
+ // ***** conversion values
+ public ListIterator conversionValues() {
+ return new CloneListIterator(this.conversionValues);
+ }
+
+ ListIterator nestableConversionValues() {
+ return new CloneListIterator(this.conversionValues);
+ }
+
+ public int conversionValuesSize() {
+ return this.conversionValues.size();
+ }
+
+ public NestableConversionValueAnnotation conversionValueAt(int index) {
+ return this.conversionValues.get(index);
+ }
+
+ public int indexOfConversionValue(ConversionValueAnnotation conversionValue) {
+ return this.conversionValues.indexOf(conversionValue);
+ }
+
+ public NestableConversionValueAnnotation addConversionValue(int index) {
+ return (NestableConversionValueAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.conversionValuesContainer);
+ }
+
+ NestableConversionValueAnnotation addConversionValueInternal() {
+ NestableConversionValueAnnotation conversionValue = this.buildConversionValue(this.conversionValues.size());
+ this.conversionValues.add(conversionValue);
+ return conversionValue;
+ }
+
+ private NestableConversionValueAnnotation buildConversionValue(int index) {
+ return SourceConversionValueAnnotation.createConversionValue(this, this.member, this.daa, index);
+ }
+
+ void conversionValueAdded(int index, NestableConversionValueAnnotation conversionValue) {
+ this.fireItemAdded(CONVERSION_VALUES_LIST, index, conversionValue);
+ }
+
+ public void moveConversionValue(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.conversionValuesContainer);
+ }
+
+ NestableConversionValueAnnotation moveConversionValueInternal(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.conversionValues, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ void conversionValueMoved(int targetIndex, int sourceIndex) {
+ this.fireItemMoved(CONVERSION_VALUES_LIST, targetIndex, sourceIndex);
+ }
+
+ public void removeConversionValue(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.conversionValuesContainer);
+ }
+
+ NestableConversionValueAnnotation removeConversionValueInternal(int index) {
+ return this.conversionValues.remove(index);
+ }
+
+ void conversionValueRemoved(int index, NestableConversionValueAnnotation conversionValue) {
+ this.fireItemRemoved(CONVERSION_VALUES_LIST, index, conversionValue);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildDefaultObjectValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE, false, StringExpressionConverter.instance());
+ }
+
+
+ // ********** conversion value container **********
+
+ /**
+ * adapt the AnnotationContainer interface to the object type converter's
+ * conversion values
+ */
+ class ConversionValuesAnnotationContainer
+ implements AnnotationContainer
+ {
+ public String getContainerAnnotationName() {
+ return SourceObjectTypeConverterAnnotation.this.getAnnotationName();
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit astRoot) {
+ return SourceObjectTypeConverterAnnotation.this.getJdtAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES;
+ }
+
+ public String getNestableAnnotationName() {
+ return ConversionValueAnnotation.ANNOTATION_NAME;
+ }
+
+ public ListIterator nestedAnnotations() {
+ return SourceObjectTypeConverterAnnotation.this.nestableConversionValues();
+ }
+
+ public int nestedAnnotationsSize() {
+ return SourceObjectTypeConverterAnnotation.this.conversionValuesSize();
+ }
+
+ public NestableConversionValueAnnotation addNestedAnnotationInternal() {
+ return SourceObjectTypeConverterAnnotation.this.addConversionValueInternal();
+ }
+
+ public void nestedAnnotationAdded(int index, NestableConversionValueAnnotation nestedAnnotation) {
+ SourceObjectTypeConverterAnnotation.this.conversionValueAdded(index, nestedAnnotation);
+ }
+
+ public NestableConversionValueAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
+ return SourceObjectTypeConverterAnnotation.this.moveConversionValueInternal(targetIndex, sourceIndex);
+ }
+
+ public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
+ SourceObjectTypeConverterAnnotation.this.conversionValueMoved(targetIndex, sourceIndex);
+ }
+
+ public NestableConversionValueAnnotation removeNestedAnnotationInternal(int index) {
+ return SourceObjectTypeConverterAnnotation.this.removeConversionValueInternal(index);
+ }
+
+ public void nestedAnnotationRemoved(int index, NestableConversionValueAnnotation nestedAnnotation) {
+ SourceObjectTypeConverterAnnotation.this.conversionValueRemoved(index, nestedAnnotation);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryPrivateOwnedAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryPrivateOwnedAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryPrivateOwnedAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryPrivateOwnedAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.PrivateOwned
+ */
+public final class BinaryPrivateOwnedAnnotation
+ extends BinaryAnnotation
+ implements PrivateOwnedAnnotation
+{
+
+ public BinaryPrivateOwnedAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicMapAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicMapAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicMapAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryBasicMapAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.BasicMap
+ */
+public final class BinaryBasicMapAnnotation
+ extends BinaryAnnotation
+ implements BasicMapAnnotation
+{
+ public BinaryBasicMapAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryExistenceCheckingAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryExistenceCheckingAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryExistenceCheckingAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryExistenceCheckingAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType;
+
+/**
+ * org.eclipse.persistence.annotations.ExistenceChecking
+ */
+public final class BinaryExistenceCheckingAnnotation
+ extends BinaryAnnotation
+ implements ExistenceCheckingAnnotation
+{
+ private ExistenceType value;
+
+
+ public BinaryExistenceCheckingAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** ExistenceCheckingAnnotation implementation **********
+
+ // ***** value
+ public ExistenceType getValue() {
+ return this.value;
+ }
+
+ public void setValue(ExistenceType value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(ExistenceType value) {
+ ExistenceType old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private ExistenceType buildValue() {
+ return ExistenceType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLinkJPA.EXISTENCE_CHECKING__VALUE));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceWriteTransformerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceWriteTransformerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceWriteTransformerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceWriteTransformerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceColumnAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.core.resource.java.JPA;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.NullWriteTransformerColumnAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.WriteTransformer
+ */
+public final class SourceWriteTransformerAnnotation
+ extends SourceTransformerAnnotation
+ implements WriteTransformerAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final MemberAnnotationAdapter columnAdapter;
+ private ColumnAnnotation column;
+
+
+ public SourceWriteTransformerAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.columnAdapter = new MemberAnnotationAdapter(this.member, buildColumnAnnotationAdapter(this.daa));
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ if (this.columnAdapter.getAnnotation(astRoot) != null) {
+ this.column = createColumn(this, this.member, this.daa);
+ this.column.initialize(astRoot);
+ }
+ }
+
+ @Override
+ public void update(CompilationUnit astRoot) {
+ super.update(astRoot);
+ if (this.columnAdapter.getAnnotation(astRoot) == null) {
+ this.setColumn(null);
+ } else {
+ if (this.column == null) {
+ ColumnAnnotation col = createColumn(this, this.member, this.daa);
+ col.initialize(astRoot);
+ this.setColumn(col);
+ } else {
+ this.column.update(astRoot);
+ }
+ }
+ }
+
+
+ // ********** SourceTransformerAnnotation implementation **********
+
+ @Override
+ String getTransformerClassElementName() {
+ return EclipseLinkJPA.WRITE_TRANSFORMER__TRANSFORMER_CLASS;
+ }
+
+ @Override
+ String getMethodElementName() {
+ return EclipseLinkJPA.WRITE_TRANSFORMER__METHOD;
+ }
+
+
+ // ********** WriteTransformerAnnotation implementation **********
+
+ // ***** column
+ public ColumnAnnotation getColumn() {
+ return this.column;
+ }
+
+ public ColumnAnnotation getNonNullColumn() {
+ return (this.column != null) ? this.column : new NullWriteTransformerColumnAnnotation(this);
+ }
+
+ public ColumnAnnotation addColumn() {
+ ColumnAnnotation col = createColumn(this, this.member, this.daa);
+ col.newAnnotation();
+ this.setColumn(col);
+ return col;
+ }
+
+ public void removeColumn() {
+ this.column.removeAnnotation();
+ this.setColumn(null);
+ }
+
+ private void setColumn(ColumnAnnotation newColumn) {
+ ColumnAnnotation old = this.column;
+ this.column = newColumn;
+ this.firePropertyChanged(COLUMN_PROPERTY, old, newColumn);
+ }
+
+ public TextRange getColumnTextRange(CompilationUnit astRoot) {
+ if (this.column != null) {
+ return this.column.getTextRange(astRoot);
+ }
+ return getTextRange(astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationAdapter buildColumnAnnotationAdapter(DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) {
+ return new NestedDeclarationAnnotationAdapter(writeTransformerAnnotationAdapter, EclipseLinkJPA.WRITE_TRANSFORMER__COLUMN, JPA.COLUMN, false);
+ }
+
+ private static ColumnAnnotation createColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) {
+ return new SourceColumnAnnotation(parent, member, buildColumnAnnotationAdapter(writeTransformerAnnotationAdapter));
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTimeOfDayAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTimeOfDayAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTimeOfDayAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTimeOfDayAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.TimeOfDay
+ */
+public final class SourceTimeOfDayAnnotation
+ extends SourceAnnotation
+ implements TimeOfDayAnnotation
+{
+ private final DeclarationAnnotationElementAdapter hourDeclarationAdapter;
+ private final AnnotationElementAdapter hourAdapter;
+ private Integer hour;
+
+ private final DeclarationAnnotationElementAdapter minuteDeclarationAdapter;
+ private final AnnotationElementAdapter minuteAdapter;
+ private Integer minute;
+
+ private final DeclarationAnnotationElementAdapter secondDeclarationAdapter;
+ private final AnnotationElementAdapter secondAdapter;
+ private Integer second;
+
+ private final DeclarationAnnotationElementAdapter millisecondDeclarationAdapter;
+ private final AnnotationElementAdapter millisecondAdapter;
+ private Integer millisecond;
+
+
+ public SourceTimeOfDayAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa) {
+ super(parent, type, daa);
+ this.hourDeclarationAdapter = buildHourAdapter(daa);
+ this.hourAdapter = new ShortCircuitAnnotationElementAdapter(type, this.hourDeclarationAdapter);
+ this.minuteDeclarationAdapter = buildMinuteAdapter(daa);
+ this.minuteAdapter = new ShortCircuitAnnotationElementAdapter(type, this.minuteDeclarationAdapter);
+ this.secondDeclarationAdapter = buildSecondAdapter(daa);
+ this.secondAdapter = new ShortCircuitAnnotationElementAdapter(type, this.secondDeclarationAdapter);
+ this.millisecondDeclarationAdapter = buildMillisecondAdapter(daa);
+ this.millisecondAdapter = new ShortCircuitAnnotationElementAdapter(type, this.millisecondDeclarationAdapter);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.hour = this.buildHour(astRoot);
+ this.minute = this.buildMinute(astRoot);
+ this.second = this.buildSecond(astRoot);
+ this.millisecond = this.buildMillisecond(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setHour(this.buildHour(astRoot));
+ this.setMinute(this.buildMinute(astRoot));
+ this.setSecond(this.buildSecond(astRoot));
+ this.setMillisecond(this.buildMillisecond(astRoot));
+ }
+
+
+ // ********** TimeOfDayAnnotation implementation **********
+
+ // ***** hour
+ public Integer getHour() {
+ return this.hour;
+ }
+
+ public void setHour(Integer hour) {
+ if (this.attributeValueHasNotChanged(this.hour, hour)) {
+ return;
+ }
+ Integer old = this.hour;
+ this.hour = hour;
+ this.hourAdapter.setValue(hour);
+ this.firePropertyChanged(HOUR_PROPERTY, old, hour);
+ }
+
+ private Integer buildHour(CompilationUnit astRoot) {
+ return this.hourAdapter.getValue(astRoot);
+ }
+
+ public TextRange getHourTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.hourDeclarationAdapter, astRoot);
+ }
+
+ // ***** minute
+ public Integer getMinute() {
+ return this.minute;
+ }
+
+ public void setMinute(Integer newMinute) {
+ if (attributeValueHasNotChanged(this.minute, newMinute)) {
+ return;
+ }
+ Integer oldMinute = this.minute;
+ this.minute = newMinute;
+ this.minuteAdapter.setValue(newMinute);
+ firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute);
+ }
+
+ private Integer buildMinute(CompilationUnit astRoot) {
+ return this.minuteAdapter.getValue(astRoot);
+ }
+
+ public TextRange getMinuteTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.minuteDeclarationAdapter, astRoot);
+ }
+
+ // ***** second
+ public Integer getSecond() {
+ return this.second;
+ }
+
+ public void setSecond(Integer newSecond) {
+ if (attributeValueHasNotChanged(this.second, newSecond)) {
+ return;
+ }
+ Integer oldSecond = this.second;
+ this.second = newSecond;
+ this.secondAdapter.setValue(newSecond);
+ firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond);
+ }
+
+ private Integer buildSecond(CompilationUnit astRoot) {
+ return this.secondAdapter.getValue(astRoot);
+ }
+
+ public TextRange getSecondTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.secondDeclarationAdapter, astRoot);
+ }
+
+ // ***** millisecond
+ public Integer getMillisecond() {
+ return this.millisecond;
+ }
+
+ public void setMillisecond(Integer newMillisecond) {
+ if (attributeValueHasNotChanged(this.millisecond, newMillisecond)) {
+ return;
+ }
+ Integer oldMillisecond = this.millisecond;
+ this.millisecond = newMillisecond;
+ this.millisecondAdapter.setValue(newMillisecond);
+ firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond);
+ }
+
+ private Integer buildMillisecond(CompilationUnit astRoot) {
+ return this.millisecondAdapter.getValue(astRoot);
+ }
+
+ public TextRange getMillisecondTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.millisecondDeclarationAdapter, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildHourAdapter(DeclarationAnnotationAdapter daa) {
+ return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__HOUR, false, NumberIntegerExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildMinuteAdapter(DeclarationAnnotationAdapter daa) {
+ return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__MINUTE, false, NumberIntegerExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildSecondAdapter(DeclarationAnnotationAdapter daa) {
+ return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__SECOND, false, NumberIntegerExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildMillisecondAdapter(DeclarationAnnotationAdapter daa) {
+ return new ConversionDeclarationAnnotationElementAdapter(daa, EclipseLinkJPA.TIME_OF_DAY__MILLISECOND, false, NumberIntegerExpressionConverter.instance());
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTypeConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTypeConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTypeConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTypeConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.TypeConverter
+ */
+public final class BinaryTypeConverterAnnotation
+ extends BinaryBaseTypeConverterAnnotation
+ implements TypeConverterAnnotation
+{
+ public BinaryTypeConverterAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.TYPE_CONVERTER__NAME;
+ }
+
+
+ // ********** BinaryBaseTypeConverterAnnotation implementation **********
+
+ @Override
+ String getDataTypeElementName() {
+ return EclipseLinkJPA.TYPE_CONVERTER__DATA_TYPE;
+ }
+
+ @Override
+ String getObjectTypeElementName() {
+ return EclipseLinkJPA.TYPE_CONVERTER__OBJECT_TYPE;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryExistenceCheckingAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceExistenceCheckingAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ExistenceChecking
+ */
+public class ExistenceCheckingAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ExistenceCheckingAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ExistenceCheckingAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceExistenceCheckingAnnotation((JavaResourcePersistentType) parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryExistenceCheckingAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ExistenceCheckingAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceMutableAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceMutableAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceMutableAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceMutableAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Mutable
+ */
+public final class SourceMutableAnnotation
+ extends SourceAnnotation
+ implements MutableAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter valueAdapter;
+ private Boolean value;
+
+
+ public SourceMutableAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter(attribute, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** MutableAnnotation implementation **********
+
+ // ***** value
+ public Boolean getValue() {
+ return this.value;
+ }
+
+ public void setValue(Boolean value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ Boolean old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private Boolean buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.MUTABLE__VALUE, false, BooleanExpressionConverter.instance());
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryWriteTransformerAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceWriteTransformerAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.WriteTransformer
+ */
+public class WriteTransformerAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new WriteTransformerAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private WriteTransformerAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceWriteTransformerAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryWriteTransformerAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return WriteTransformerAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCustomizerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCustomizerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCustomizerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCustomizerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.Customizer
+ */
+public final class BinaryCustomizerAnnotation
+ extends BinaryAnnotation
+ implements CustomizerAnnotation
+{
+ private String value;
+
+
+ public BinaryCustomizerAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** CustomizerAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(EclipseLinkJPA.CUSTOMIZER__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean customizerClassImplementsInterface(String interfaceName, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryReadTransformerAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceReadTransformerAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ReadTransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadTransformer
+ */
+public class ReadTransformerAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ReadTransformerAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ReadTransformerAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceReadTransformerAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryReadTransformerAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ReadTransformerAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumnAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumnAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumnAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumnAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jpt.core.internal.resource.java.NullColumnAnnotation;
+import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation;
+
+/**
+ * javax.persistence.Column
+ */
+public class NullWriteTransformerColumnAnnotation
+ extends NullColumnAnnotation
+{
+ public NullWriteTransformerColumnAnnotation(WriteTransformerAnnotation parent) {
+ super(parent);
+ }
+
+ private WriteTransformerAnnotation getWriteTransformerAnnotation() {
+ return (WriteTransformerAnnotation) this.parent;
+ }
+
+ @Override
+ protected ColumnAnnotation buildAnnotation() {
+ return this.getWriteTransformerAnnotation().addColumn();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryReadOnlyAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceReadOnlyAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadOnly
+ */
+public class ReadOnlyAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ReadOnlyAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ReadOnlyAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceReadOnlyAnnotation(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryReadOnlyAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ReadOnlyAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryObjectTypeConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryObjectTypeConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryObjectTypeConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryObjectTypeConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+/**
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ */
+public final class BinaryObjectTypeConverterAnnotation
+ extends BinaryBaseTypeConverterAnnotation
+ implements ObjectTypeConverterAnnotation
+{
+ private String defaultObjectValue;
+ private final Vector conversionValues;
+
+
+ public BinaryObjectTypeConverterAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.defaultObjectValue = this.buildDefaultObjectValue();
+ this.conversionValues = this.buildConversionValues();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDefaultObjectValue_(this.buildDefaultObjectValue());
+ this.updateConversionValues();
+ }
+
+
+ // ********** BinaryNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__NAME;
+ }
+
+ // ********** BinaryBaseTypeConverterAnnotation implementation **********
+
+ @Override
+ String getDataTypeElementName() {
+ return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DATA_TYPE;
+ }
+
+ @Override
+ String getObjectTypeElementName() {
+ return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__OBJECT_TYPE;
+ }
+
+ // ********** ObjectTypeConverterAnnotation implementation **********
+
+ // ***** default object value
+ public String getDefaultObjectValue() {
+ return this.defaultObjectValue;
+ }
+
+ public void setDefaultObjectValue(String defaultObjectValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDefaultObjectValue_(String defaultObjectValue) {
+ String old = this.defaultObjectValue;
+ this.defaultObjectValue = defaultObjectValue;
+ this.firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, old, defaultObjectValue);
+ }
+
+ private String buildDefaultObjectValue() {
+ return (String) this.getJdtMemberValue(EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE);
+ }
+
+ public TextRange getDefaultObjectValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** conversion values
+ public ListIterator conversionValues() {
+ return new CloneListIterator(this.conversionValues);
+ }
+
+ public int conversionValuesSize() {
+ return this.conversionValues.size();
+ }
+
+ public ConversionValueAnnotation conversionValueAt(int index) {
+ return this.conversionValues.get(index);
+ }
+
+ public int indexOfConversionValue(ConversionValueAnnotation conversionValue) {
+ return this.conversionValues.indexOf(conversionValue);
+ }
+
+ public ConversionValueAnnotation addConversionValue(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveConversionValue(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeConversionValue(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ private Vector buildConversionValues() {
+ Object[] jdtConversionValues = this.getJdtMemberValues(EclipseLinkJPA.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES);
+ Vector result = new Vector(jdtConversionValues.length);
+ for (Object jdtConversionValue : jdtConversionValues) {
+ result.add(new BinaryConversionValueAnnotation(this, (IAnnotation) jdtConversionValue));
+ }
+ return result;
+ }
+
+ // TODO
+ private void updateConversionValues() {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.TransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadTransformer
+ * org.eclipse.persistence.annotations.WriteTransformer
+ */
+abstract class BinaryTransformerAnnotation
+ extends BinaryAnnotation
+ implements TransformerAnnotation
+{
+ private String transformerClass;
+ private String method;
+
+
+ BinaryTransformerAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.transformerClass = this.buildTransformerClass();
+ this.method = this.buildMethod();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setTransformerClass_(this.buildTransformerClass());
+ this.setMethod_(this.buildMethod());
+ }
+
+
+ // ********** TransformerAnnotation implementation **********
+
+ // ***** transformer class
+ public String getTransformerClass() {
+ return this.transformerClass;
+ }
+
+ public void setTransformerClass(String transformerClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setTransformerClass_(String transformerClass) {
+ String old = this.transformerClass;
+ this.transformerClass = transformerClass;
+ this.firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, old, transformerClass);
+ }
+
+ private String buildTransformerClass() {
+ return (String) this.getJdtMemberValue(this.getTransformerClassElementName());
+ }
+
+ public TextRange getTransformerClassTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ abstract String getTransformerClassElementName();
+
+ // ***** method
+ public String getMethod() {
+ return this.method;
+ }
+
+ public void setMethod(String method) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setMethod_(String method) {
+ String old = this.method;
+ this.method = method;
+ this.firePropertyChanged(METHOD_PROPERTY, old, method);
+ }
+
+ private String buildMethod() {
+ return (String) this.getJdtMemberValue(this.getMethodElementName());
+ }
+
+ public TextRange getMethodTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ abstract String getMethodElementName();
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryStructConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceStructConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.StructConverter
+ */
+public class StructConverterAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new StructConverterAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private StructConverterAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceStructConverterAnnotation(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryStructConverterAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return StructConverterAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValueAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValueAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValueAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/NestableConversionValueAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 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.eclipselink.core.resource.java;
+
+import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+
+/**
+ * Corresponds to the EclipseLink annotation
+ * org.eclipse.persistence.annotations.ConversionValue
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface NestableConversionValueAnnotation
+ extends ConversionValueAnnotation, NestableAnnotation
+{
+ // combine two interfaces
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformationAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformationAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformationAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryTransformationAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.FetchType;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Transformation
+ */
+public class BinaryTransformationAnnotation
+ extends BinaryAnnotation
+ implements TransformationAnnotation
+{
+ private FetchType fetch;
+ private Boolean optional;
+
+
+ public BinaryTransformationAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.fetch = this.buildFetch();
+ this.optional = this.buildOptional();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setFetch_(this.buildFetch());
+ this.setOptional_(this.buildOptional());
+ }
+
+
+ // ********** TransformationAnnotation implementation **********
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setFetch_(FetchType fetch) {
+ FetchType old = this.fetch;
+ this.fetch = fetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
+ }
+
+ private FetchType buildFetch() {
+ return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLinkJPA.TRANSFORMATION__FETCH));
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setOptional_(Boolean optional) {
+ Boolean old = this.optional;
+ this.optional = optional;
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
+ }
+
+ private Boolean buildOptional() {
+ return (Boolean) this.getJdtMemberValue(EclipseLinkJPA.TRANSFORMATION__OPTIONAL);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.Converter
+ */
+public final class SourceConverterAnnotation
+ extends SourceNamedConverterAnnotation
+ implements ConverterAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter CONVERTER_CLASS_ADAPTER = buildConverterClassAdapter();
+ private final AnnotationElementAdapter converterClassAdapter;
+ private String converterClass;
+
+
+ public SourceConverterAnnotation(JavaResourcePersistentMember parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.converterClassAdapter = new ShortCircuitAnnotationElementAdapter(member, CONVERTER_CLASS_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.converterClass = this.buildConverterClass(astRoot);
+ }
+
+ @Override
+ public void update(CompilationUnit astRoot) {
+ super.update(astRoot);
+ this.setConverterClass(this.buildConverterClass(astRoot));
+ }
+
+
+ // ********** SourceNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.CONVERTER__NAME;
+ }
+
+
+ // ********** ConverterAnnotation implementation **********
+
+ // ***** converter class
+ public String getConverterClass() {
+ return this.converterClass;
+ }
+
+ public void setConverterClass(String converterClass) {
+ if (this.attributeValueHasNotChanged(this.converterClass, converterClass)) {
+ return;
+ }
+ String old = this.converterClass;
+ this.converterClass = converterClass;
+ this.converterClassAdapter.setValue(converterClass);
+ this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, old, converterClass);
+ }
+
+ private String buildConverterClass(CompilationUnit astRoot) {
+ return this.converterClassAdapter.getValue(astRoot);
+ }
+
+ public TextRange getConverterClassTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(CONVERTER_CLASS_ADAPTER, astRoot);
+ }
+
+ public boolean converterClassImplementsInterface(String interfaceName, CompilationUnit astRoot) {
+ return (this.converterClass != null)
+ && JDTTools.typeIsSubTypeOf(this.converterClassAdapter.getExpression(astRoot), interfaceName);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildConverterClassAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERTER__CONVERTER_CLASS, false, SimpleTypeStringExpressionConverter.instance());
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTypeConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTypeConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTypeConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTypeConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.TypeConverter
+ */
+public final class SourceTypeConverterAnnotation
+ extends SourceBaseTypeConverterAnnotation
+ implements TypeConverterAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceTypeConverterAnnotation(JavaResourcePersistentMember parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** SourceNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.TYPE_CONVERTER__NAME;
+ }
+
+
+ // ********** SourceBaseTypeConverterAnnotation implementation **********
+
+ @Override
+ String getDataTypeElementName() {
+ return EclipseLinkJPA.TYPE_CONVERTER__DATA_TYPE;
+ }
+
+ @Override
+ String getObjectTypeElementName() {
+ return EclipseLinkJPA.TYPE_CONVERTER__OBJECT_TYPE;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicCollectionAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicCollectionAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicCollectionAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicCollectionAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.BasicCollection
+ */
+public final class SourceBasicCollectionAnnotation
+ extends SourceAnnotation
+ implements BasicCollectionAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceBasicCollectionAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // do nothing
+ }
+
+ public void update(CompilationUnit astRoot) {
+ // do nothing
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceVariableOneToOneAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceVariableOneToOneAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceVariableOneToOneAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceVariableOneToOneAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.VariableOneToOneAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.VariableOneToOne
+ */
+public final class SourceVariableOneToOneAnnotation
+ extends SourceAnnotation
+ implements VariableOneToOneAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceVariableOneToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public void update(CompilationUnit astRoot) {
+ // nothing to update
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicMapAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicMapAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicMapAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBasicMapAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.BasicMap
+ */
+public final class SourceBasicMapAnnotation
+ extends SourceAnnotation
+ implements BasicMapAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceBasicMapAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // do nothing
+ }
+
+ public void update(CompilationUnit astRoot) {
+ // do nothing
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryChangeTrackingAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceChangeTrackingAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ChangeTracking
+ */
+public class ChangeTrackingAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ChangeTrackingAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ChangeTrackingAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceChangeTrackingAnnotation((JavaResourcePersistentType) parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryChangeTrackingAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ChangeTrackingAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryPrivateOwnedAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourcePrivateOwnedAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.PrivateOwned
+ */
+public class PrivateOwnedAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new PrivateOwnedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private PrivateOwnedAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourcePrivateOwnedAnnotation(parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryPrivateOwnedAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return PrivateOwnedAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.Converter
+ */
+public final class BinaryConverterAnnotation
+ extends BinaryNamedConverterAnnotation
+ implements ConverterAnnotation
+{
+ private String converterClass;
+
+
+ public BinaryConverterAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.converterClass = this.buildConverterClass();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setConverterClass_(this.buildConverterClass());
+ }
+
+
+ // ********** BinaryNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.CONVERTER__NAME;
+ }
+
+ // ********** ConverterAnnotation implementation **********
+
+ // ***** converter class
+ public String getConverterClass() {
+ return this.converterClass;
+ }
+
+ public void setConverterClass(String converterClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setConverterClass_(String converterClass) {
+ String old = this.converterClass;
+ this.converterClass = converterClass;
+ this.firePropertyChanged(CONVERTER_CLASS_PROPERTY, old, converterClass);
+ }
+
+ private String buildConverterClass() {
+ return (String) this.getJdtMemberValue(EclipseLinkJPA.CONVERTER__CONVERTER_CLASS);
+ }
+
+ public TextRange getConverterClassTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean converterClassImplementsInterface(String interfaceName, CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryWriteTransformerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryWriteTransformerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryWriteTransformerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryWriteTransformerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryColumnAnnotation;
+import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.NullWriteTransformerColumnAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadTransformer
+ */
+public class BinaryWriteTransformerAnnotation
+ extends BinaryTransformerAnnotation
+ implements WriteTransformerAnnotation
+{
+ private ColumnAnnotation column;
+
+
+ public BinaryWriteTransformerAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.column = this.buildColumn();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateColumn();
+ }
+
+
+ // ********** BinaryTransformerAnnotation implementation **********
+
+ @Override
+ String getTransformerClassElementName() {
+ return EclipseLinkJPA.WRITE_TRANSFORMER__TRANSFORMER_CLASS;
+ }
+
+ @Override
+ String getMethodElementName() {
+ return EclipseLinkJPA.WRITE_TRANSFORMER__METHOD;
+ }
+
+
+ // ********** WriteTransformerAnnotation implementation **********
+
+ // ***** column
+ public ColumnAnnotation getColumn() {
+ return this.column;
+ }
+
+ public ColumnAnnotation getNonNullColumn() {
+ return (this.column != null) ? this.column : new NullWriteTransformerColumnAnnotation(this);
+ }
+
+ public ColumnAnnotation addColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ public TextRange getColumnTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ private ColumnAnnotation buildColumn() {
+ IAnnotation jdtColumn = this.getJdtColumn();
+ return (jdtColumn == null) ? null : this.buildColumn(jdtColumn);
+ }
+
+ private ColumnAnnotation buildColumn(IAnnotation jdtColumn) {
+ return new BinaryColumnAnnotation(this, jdtColumn);
+ }
+
+ private IAnnotation getJdtColumn() {
+ return (IAnnotation) this.getJdtMemberValue(EclipseLinkJPA.WRITE_TRANSFORMER__COLUMN);
+ }
+
+ private void setColumn(ColumnAnnotation column) {
+ ColumnAnnotation old = this.column;
+ this.column = column;
+ this.firePropertyChanged(COLUMN_PROPERTY, old, column);
+ }
+
+ // TODO
+ private void updateColumn() {
+ throw new UnsupportedOperationException();
+// IAnnotation jdtColumn = this.getJdtColumn();
+// if (jdtColumn == null) {
+// this.setColumn(null);
+// } else {
+// if (this.column == null) {
+// this.setColumn(this.buildColumn(jdtColumn));
+// } else {
+// this.column.update(jdtColumn);
+// }
+// }
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCacheAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCacheAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCacheAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryCacheAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,311 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType;
+import org.eclipse.jpt.eclipselink.core.resource.java.CacheType;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Cache
+ */
+public final class BinaryCacheAnnotation
+ extends BinaryAnnotation
+ implements CacheAnnotation
+{
+ private CacheType type;
+ private Integer size;
+ private Boolean shared;
+ private Integer expiry;
+ private TimeOfDayAnnotation expiryTimeOfDay;
+ private Boolean alwaysRefresh;
+ private Boolean refreshOnlyIfNewer;
+ private Boolean disableHits;
+ private CacheCoordinationType coordinationType;
+
+
+ public BinaryCacheAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.type = this.buildType();
+ this.size = this.buildSize();
+ this.shared = this.buildShared();
+ this.expiry = this.buildExpiry();
+ this.expiryTimeOfDay = this.buildExpiryTimeOfDay();
+ this.alwaysRefresh = this.buildAlwaysRefresh();
+ this.refreshOnlyIfNewer = this.buildRefreshOnlyIfNewer();
+ this.disableHits = this.buildDisableHits();
+ this.coordinationType = this.buildCoordinationType();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // TODO
+ @Override
+ public void update() {
+ super.update();
+ this.setType_(this.buildType());
+ this.setSize_(this.buildSize());
+ this.setShared_(this.buildShared());
+ this.setExpiry_(this.buildExpiry());
+ this.updateExpiryTimeOfDay();
+ this.setAlwaysRefresh_(this.buildAlwaysRefresh());
+ this.setRefreshOnlyIfNewer_(this.buildRefreshOnlyIfNewer());
+ this.setDisableHits_(this.buildDisableHits());
+ this.setCoordinationType_(this.buildCoordinationType());
+ }
+
+
+ // ********** CacheAnnotation implementation **********
+
+ // ***** type
+ public CacheType getType() {
+ return this.type;
+ }
+
+ public void setType(CacheType type) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setType_(CacheType type) {
+ CacheType old = this.type;
+ this.type = type;
+ this.firePropertyChanged(TYPE_PROPERTY, old, type);
+ }
+
+ private CacheType buildType() {
+ return CacheType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLinkJPA.CACHE__TYPE));
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** size
+ public Integer getSize() {
+ return this.size;
+ }
+
+ public void setSize(Integer size) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setSize_(Integer size) {
+ Integer old = this.size;
+ this.size = size;
+ this.firePropertyChanged(SIZE_PROPERTY, old, size);
+ }
+
+ private Integer buildSize() {
+ return (Integer) this.getJdtMemberValue(EclipseLinkJPA.CACHE__SIZE);
+ }
+
+ public TextRange getSizeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** shared
+ public Boolean getShared() {
+ return this.shared;
+ }
+
+ public void setShared(Boolean shared) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setShared_(Boolean shared) {
+ Boolean old = this.shared;
+ this.shared = shared;
+ this.firePropertyChanged(SHARED_PROPERTY, old, shared);
+ }
+
+ private Boolean buildShared() {
+ return (Boolean) this.getJdtMemberValue(EclipseLinkJPA.CACHE__SHARED);
+ }
+
+ public TextRange getSharedTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** expiry
+ public Integer getExpiry() {
+ return this.expiry;
+ }
+
+ public void setExpiry(Integer expiry) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setExpiry_(Integer expiry) {
+ Integer old = this.expiry;
+ this.expiry = expiry;
+ this.firePropertyChanged(EXPIRY_PROPERTY, old, expiry);
+ }
+
+ private Integer buildExpiry() {
+ return (Integer) this.getJdtMemberValue(EclipseLinkJPA.CACHE__EXPIRY);
+ }
+
+ public TextRange getExpiryTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** expiry time of day
+ public TimeOfDayAnnotation getExpiryTimeOfDay() {
+ return this.expiryTimeOfDay;
+ }
+
+ public TimeOfDayAnnotation addExpiryTimeOfDay() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeExpiryTimeOfDay() {
+ throw new UnsupportedOperationException();
+ }
+
+ private TimeOfDayAnnotation buildExpiryTimeOfDay() {
+ IAnnotation jdtTimeOfDay = this.getJdtExpiryTimeOfDay();
+ return (jdtTimeOfDay == null) ? null : this.buildTimeOfDay(jdtTimeOfDay);
+ }
+
+ private TimeOfDayAnnotation buildTimeOfDay(IAnnotation jdtTimeOfDay) {
+ return new BinaryTimeOfDayAnnotation(this, jdtTimeOfDay);
+ }
+
+ private IAnnotation getJdtExpiryTimeOfDay() {
+ return (IAnnotation) this.getJdtMemberValue(EclipseLinkJPA.CACHE__EXPIRY_TIME_OF_DAY);
+ }
+
+ private void setExpiryTimeOfDay(TimeOfDayAnnotation expiryTimeOfDay) {
+ TimeOfDayAnnotation old = this.expiryTimeOfDay;
+ this.expiryTimeOfDay = expiryTimeOfDay;
+ this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, expiryTimeOfDay);
+ }
+
+ // TODO
+ private void updateExpiryTimeOfDay() {
+ throw new UnsupportedOperationException();
+// IAnnotation jdtTimeOfDay = this.getJdtExpiryTimeOfDay();
+// if (jdtTimeOfDay == null) {
+// this.setExpiryTimeOfDay(null);
+// } else {
+// if (this.expiryTimeOfDay == null) {
+// this.setExpiryTimeOfDay(this.buildTimeOfDay(jdtTimeOfDay));
+// } else {
+// this.expiryTimeOfDay.update(jdtTimeOfDay);
+// }
+// }
+ }
+
+ public TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** always refresh
+ public Boolean getAlwaysRefresh() {
+ return this.alwaysRefresh;
+ }
+
+ public void setAlwaysRefresh(Boolean alwaysRefresh) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setAlwaysRefresh_(Boolean alwaysRefresh) {
+ Boolean old = this.alwaysRefresh;
+ this.alwaysRefresh = alwaysRefresh;
+ this.firePropertyChanged(ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh);
+ }
+
+ private Boolean buildAlwaysRefresh() {
+ return (Boolean) this.getJdtMemberValue(EclipseLinkJPA.CACHE__ALWAYS_REFRESH);
+ }
+
+ public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** refresh only if newer
+ public Boolean getRefreshOnlyIfNewer() {
+ return this.refreshOnlyIfNewer;
+ }
+
+ public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setRefreshOnlyIfNewer_(Boolean refreshOnlyIfNewer) {
+ Boolean old = this.refreshOnlyIfNewer;
+ this.refreshOnlyIfNewer = refreshOnlyIfNewer;
+ this.firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer);
+ }
+
+ private Boolean buildRefreshOnlyIfNewer() {
+ return (Boolean) this.getJdtMemberValue(EclipseLinkJPA.CACHE__REFRESH_ONLY_IF_NEWER);
+ }
+
+ public TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** disable hits
+ public Boolean getDisableHits() {
+ return this.disableHits;
+ }
+
+ public void setDisableHits(Boolean disableHits) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDisableHits_(Boolean disableHits) {
+ Boolean old = this.disableHits;
+ this.disableHits = disableHits;
+ this.firePropertyChanged(DISABLE_HITS_PROPERTY, old, disableHits);
+ }
+
+ private Boolean buildDisableHits() {
+ return (Boolean) this.getJdtMemberValue(EclipseLinkJPA.CACHE__DISABLE_HITS);
+ }
+
+ public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** coordination type
+ public CacheCoordinationType getCoordinationType() {
+ return this.coordinationType;
+ }
+
+ public void setCoordinationType(CacheCoordinationType coordinationType) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setCoordinationType_(CacheCoordinationType coordinationType) {
+ CacheCoordinationType old = this.coordinationType;
+ this.coordinationType = coordinationType;
+ this.firePropertyChanged(TYPE_PROPERTY, old, coordinationType);
+ }
+
+ private CacheCoordinationType buildCoordinationType() {
+ return CacheCoordinationType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLinkJPA.CACHE__COORDINATION_TYPE));
+ }
+
+ public TextRange getCoordinationTypeTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/VariableOneToOneAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryVariableOneToOneAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceVariableOneToOneAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.VariableOneToOneAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.VariableOneToOne
+ */
+public class VariableOneToOneAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new VariableOneToOneAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private VariableOneToOneAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceVariableOneToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryVariableOneToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return VariableOneToOneAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryConvertAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceConvertAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Convert
+ */
+public class ConvertAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new ConvertAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private ConvertAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceConvertAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryConvertAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ConvertAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCustomizerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCustomizerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCustomizerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCustomizerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.Customizer
+ */
+public final class SourceCustomizerAnnotation
+ extends SourceAnnotation
+ implements CustomizerAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter valueAdapter;
+ private String value;
+
+
+ public SourceCustomizerAnnotation(JavaResourcePersistentMember parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** CustomizerAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ String old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public boolean customizerClassImplementsInterface(String interfaceName, CompilationUnit astRoot) {
+ return (this.value != null)
+ && JDTTools.typeIsSubTypeOf(this.valueAdapter.getExpression(astRoot), interfaceName);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CUSTOMIZER__VALUE, false, SimpleTypeStringExpressionConverter.instance());
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryCacheAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceCacheAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Cache
+ */
+public class CacheAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new CacheAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private CacheAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceCacheAnnotation((JavaResourcePersistentType) parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ return new NullCacheAnnotation((JavaResourcePersistentType) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryCacheAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return CacheAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/resource/java/BaseTypeConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/resource/java/BaseTypeConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/resource/java/BaseTypeConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/resource/java/BaseTypeConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Common protocol among:
+ * org.eclipse.persistence.annotations.TypeConverter
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface BaseTypeConverterAnnotation
+ extends NamedConverterAnnotation
+{
+ /**
+ * Corresponds to the 'dataType' element of the TypeConverter annotation.
+ * Returns null if the element does not exist in Java.
+ */
+ String getDataType();
+ String DATA_TYPE_PROPERTY = "dataType"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'dataType' element of the TypeConverter annotation.
+ * Set to null to remove the element.
+ */
+ void setDataType(String dataType);
+
+ /**
+ * Return the {@link TextRange} for the 'dataType' element. If the element
+ * does not exist return the {@link TextRange} for the TypeConverter annotation.
+ */
+ TextRange getDataTypeTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Corresponds to the 'objectType' element of the TypeConverter annotation.
+ * Returns null if the element does not exist in Java.
+ */
+ String getObjectType();
+ String OBJECT_TYPE_PROPERTY = "objectType"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'objectType' element of the TypeConverter annotation.
+ * Set to null to remove the element.
+ */
+ void setObjectType(String objectType);
+
+ /**
+ * Return the {@link TextRange} for the 'objectType' element. If the element
+ * does not exist return the {@link TextRange} for the TypeConverter annotation.
+ */
+ TextRange getObjectTypeTextRange(CompilationUnit astRoot);
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryJoinFetchAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceJoinFetchAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.JoinFetch
+ */
+public class JoinFetchAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new JoinFetchAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private JoinFetchAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceJoinFetchAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ return new NullJoinFetchAnnotation((JavaResourcePersistentAttribute) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryJoinFetchAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return JoinFetchAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryNamedConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryNamedConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryNamedConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryNamedConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.NamedConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Converter
+ * org.eclipse.persistence.annotations.StructConverter
+ * org.eclipse.persistence.annotations.TypeConverter
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ */
+abstract class BinaryNamedConverterAnnotation
+ extends BinaryAnnotation
+ implements NamedConverterAnnotation
+{
+ String name;
+
+ BinaryNamedConverterAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setName_(this.buildName());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** NamedConverterAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(this.getNameElementName());
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ abstract String getNameElementName();
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBaseTypeConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBaseTypeConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBaseTypeConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceBaseTypeConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.TypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.resource.java.BaseTypeConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.TypeConverter
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ */
+abstract class SourceBaseTypeConverterAnnotation
+ extends SourceNamedConverterAnnotation
+ implements BaseTypeConverterAnnotation
+{
+ final DeclarationAnnotationElementAdapter dataTypeDeclarationAdapter;
+ final AnnotationElementAdapter dataTypeAdapter;
+ String dataType;
+
+ final DeclarationAnnotationElementAdapter objectTypeDeclarationAdapter;
+ final AnnotationElementAdapter objectTypeAdapter;
+ String objectType;
+
+
+ SourceBaseTypeConverterAnnotation(JavaResourcePersistentMember parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ this.dataTypeDeclarationAdapter = this.buildTypeAdapter(this.getDataTypeElementName());
+ this.dataTypeAdapter = new ShortCircuitAnnotationElementAdapter(this.member, this.dataTypeDeclarationAdapter);
+
+ this.objectTypeDeclarationAdapter = this.buildTypeAdapter(this.getObjectTypeElementName());
+ this.objectTypeAdapter = new ShortCircuitAnnotationElementAdapter(this.member, this.objectTypeDeclarationAdapter);
+ }
+
+ private DeclarationAnnotationElementAdapter buildTypeAdapter(String elementName) {
+ // false = do not remove annotation when empty
+ return new ConversionDeclarationAnnotationElementAdapter(this.daa, elementName, false, TypeStringExpressionConverter.instance());
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.dataType = this.buildDataType(astRoot);
+ this.objectType = this.buildObjectType(astRoot);
+ }
+
+ @Override
+ public void update(CompilationUnit astRoot) {
+ super.update(astRoot);
+ this.setDataType(this.buildDataType(astRoot));
+ this.setObjectType(this.buildObjectType(astRoot));
+ }
+
+
+ // ********** BaseTypeConverterAnnotation implementation **********
+
+ // ***** data type
+ public String getDataType() {
+ return this.dataType;
+ }
+
+ public void setDataType(String dataType) {
+ if (this.attributeValueHasNotChanged(this.dataType, dataType)) {
+ return;
+ }
+ String old = this.dataType;
+ this.dataType = dataType;
+ this.dataTypeAdapter.setValue(dataType);
+ this.firePropertyChanged(DATA_TYPE_PROPERTY, old, dataType);
+ }
+
+ private String buildDataType(CompilationUnit astRoot) {
+ return this.dataTypeAdapter.getValue(astRoot);
+ }
+
+ public TextRange getDataTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.dataTypeDeclarationAdapter, astRoot);
+ }
+
+ abstract String getDataTypeElementName();
+
+ // ***** object type
+ public String getObjectType() {
+ return this.objectType;
+ }
+
+ public void setObjectType(String objectType) {
+ if (this.attributeValueHasNotChanged(this.objectType, objectType)) {
+ return;
+ }
+ String old = this.objectType;
+ this.objectType = objectType;
+ this.objectTypeAdapter.setValue(objectType);
+ this.firePropertyChanged(OBJECT_TYPE_PROPERTY, old, objectType);
+ }
+
+ public TextRange getObjectTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.objectTypeDeclarationAdapter, astRoot);
+ }
+
+ private String buildObjectType(CompilationUnit astRoot) {
+ return this.objectTypeAdapter.getValue(astRoot);
+ }
+
+ abstract String getObjectTypeElementName();
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceChangeTrackingAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceChangeTrackingAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceChangeTrackingAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceChangeTrackingAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.ChangeTracking
+ */
+public final class SourceChangeTrackingAnnotation
+ extends SourceAnnotation
+ implements ChangeTrackingAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter valueAdapter;
+ private ChangeTrackingType value;
+
+
+ public SourceChangeTrackingAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** ChangeTrackingAnnotation implementation **********
+
+ // ***** value
+ public ChangeTrackingType getValue() {
+ return this.value;
+ }
+
+ public void setValue(ChangeTrackingType value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ ChangeTrackingType old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(ChangeTrackingType.toJavaAnnotationValue(value));
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private ChangeTrackingType buildValue(CompilationUnit astRoot) {
+ return ChangeTrackingType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildValueAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CHANGE_TRACKING__VALUE, false);
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConversionValueAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConversionValueAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConversionValueAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConversionValueAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.NestableConversionValueAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ConversionValue
+ */
+final class SourceConversionValueAnnotation
+ extends SourceAnnotation
+ implements NestableConversionValueAnnotation
+{
+ private final DeclarationAnnotationElementAdapter dataValueDeclarationAdapter;
+ private final AnnotationElementAdapter dataValueAdapter;
+ private String dataValue;
+
+ private final DeclarationAnnotationElementAdapter objectValueDeclarationAdapter;
+ private final AnnotationElementAdapter objectValueAdapter;
+ private String objectValue;
+
+
+ SourceConversionValueAnnotation(ObjectTypeConverterAnnotation parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ super(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
+ this.dataValueDeclarationAdapter = this.buildDataValueAdapter(idaa);
+ this.dataValueAdapter = this.buildAdapter(this.dataValueDeclarationAdapter);
+ this.objectValueDeclarationAdapter = this.buildObjectValueAdapter(idaa);
+ this.objectValueAdapter = this.buildAdapter(this.objectValueDeclarationAdapter);
+ }
+
+ private AnnotationElementAdapter buildAdapter(DeclarationAnnotationElementAdapter daea) {
+ return new ShortCircuitAnnotationElementAdapter(this.member, daea);
+ }
+
+ private DeclarationAnnotationElementAdapter buildDataValueAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, EclipseLinkJPA.CONVERSION_VALUE__DATA_VALUE, false);
+ }
+
+ private DeclarationAnnotationElementAdapter buildObjectValueAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, EclipseLinkJPA.CONVERSION_VALUE__OBJECT_VALUE, false);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.dataValue = this.buildDataValue(astRoot);
+ this.objectValue = this.buildObjectValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setDataValue(this.buildDataValue(astRoot));
+ this.setObjectValue(this.buildObjectValue(astRoot));
+ }
+
+ public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) this.annotationAdapter;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.dataValue);
+ sb.append("=>"); //$NON-NLS-1$
+ sb.append(this.objectValue);
+ }
+
+
+ // ********** ConversionValueAnnotation implementation **********
+
+ // ***** data value
+ public String getDataValue() {
+ return this.dataValue;
+ }
+
+ public void setDataValue(String dataValue) {
+ if (this.attributeValueHasNotChanged(this.dataValue, dataValue)) {
+ return;
+ }
+ String old = this.dataValue;
+ this.dataValue = dataValue;
+ this.dataValueAdapter.setValue(dataValue);
+ this.firePropertyChanged(DATA_VALUE_PROPERTY, old, dataValue);
+ }
+
+ private String buildDataValue(CompilationUnit astRoot) {
+ return this.dataValueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getDataValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.dataValueDeclarationAdapter, astRoot);
+ }
+
+ // ***** object value
+ public String getObjectValue() {
+ return this.objectValue;
+ }
+
+ public void setObjectValue(String objectValue) {
+ if (this.attributeValueHasNotChanged(this.objectValue, objectValue)) {
+ return;
+ }
+ String old = this.objectValue;
+ this.objectValue = objectValue;
+ this.objectValueAdapter.setValue(objectValue);
+ this.firePropertyChanged(OBJECT_VALUE_PROPERTY, old, objectValue);
+ }
+
+ private String buildObjectValue(CompilationUnit astRoot) {
+ return this.objectValueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getObjectValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.objectValueDeclarationAdapter, astRoot);
+ }
+
+
+ //************ NestableAnnotation implementation
+
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ ConversionValueAnnotation oldConversionValue = (ConversionValueAnnotation) oldAnnotation;
+ this.setDataValue(oldConversionValue.getDataValue());
+ this.setObjectValue(oldConversionValue.getObjectValue());
+ }
+
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+
+ // ********** static methods **********
+
+ static NestableConversionValueAnnotation createConversionValue(ObjectTypeConverterAnnotation parent, Member member, DeclarationAnnotationAdapter daa, int index) {
+ return new SourceConversionValueAnnotation(parent, member, buildConversionValueAnnotationAdapter(daa, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildConversionValueAnnotationAdapter(DeclarationAnnotationAdapter daa, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(daa, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES, index, EclipseLinkJPA.CONVERSION_VALUE, false);
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryBasicCollectionAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceBasicCollectionAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.BasicCollection
+ */
+public class BasicCollectionAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new BasicCollectionAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private BasicCollectionAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceBasicCollectionAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryBasicCollectionAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return BasicCollectionAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConvertAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConvertAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConvertAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConvertAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.Convert
+ */
+public final class BinaryConvertAnnotation
+ extends BinaryAnnotation
+ implements ConvertAnnotation
+{
+ private String value;
+
+ public BinaryConvertAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** ConvertAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(EclipseLinkJPA.CONVERT__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadTransformerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadTransformerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadTransformerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceReadTransformerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.ReadTransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadTransformer
+ */
+public final class SourceReadTransformerAnnotation
+ extends SourceTransformerAnnotation
+ implements ReadTransformerAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+
+ public SourceReadTransformerAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** SourceTransformerAnnotation implementation **********
+
+ @Override
+ String getTransformerClassElementName() {
+ return EclipseLinkJPA.READ_TRANSFORMER__TRANSFORMER_CLASS;
+ }
+
+ @Override
+ String getMethodElementName() {
+ return EclipseLinkJPA.READ_TRANSFORMER__METHOD;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceJoinFetchAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceJoinFetchAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceJoinFetchAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceJoinFetchAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType;
+
+/**
+ * org.eclipse.persistence.annotations.JoinFetch
+ */
+public final class SourceJoinFetchAnnotation
+ extends SourceAnnotation
+ implements JoinFetchAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter valueAdapter;
+ private JoinFetchType value;
+
+
+ public SourceJoinFetchAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter(attribute, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** JoinFetchAnnotation implementation **********
+
+ // ***** value
+ public JoinFetchType getValue() {
+ return this.value;
+ }
+
+ public void setValue(JoinFetchType value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ JoinFetchType old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(JoinFetchType.toJavaAnnotationValue(value));
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private JoinFetchType buildValue(CompilationUnit astRoot) {
+ return JoinFetchType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildValueAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.JOIN_FETCH__VALUE, false);
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryJoinFetchAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryJoinFetchAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryJoinFetchAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryJoinFetchAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType;
+
+/**
+ * org.eclipse.persistence.annotations.JoinFetch
+ */
+public final class BinaryJoinFetchAnnotation
+ extends BinaryAnnotation
+ implements JoinFetchAnnotation
+{
+ private JoinFetchType value;
+
+
+ public BinaryJoinFetchAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** BinaryJoinFetchAnnotation implementation **********
+
+ // ***** value
+ public JoinFetchType getValue() {
+ return this.value;
+ }
+
+ public void setValue(JoinFetchType value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(JoinFetchType value) {
+ JoinFetchType old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private JoinFetchType buildValue() {
+ return JoinFetchType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLinkJPA.JOIN_FETCH__VALUE));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryTypeConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceTypeConverterAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.TypeConverter
+ */
+public class TypeConverterAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new TypeConverterAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private TypeConverterAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceTypeConverterAnnotation(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryTypeConverterAnnotation(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return TypeConverterAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryBasicMapAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceBasicMapAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.BasicMap
+ */
+public class BasicMapAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new BasicMapAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private BasicMapAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceBasicMapAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryBasicMapAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return BasicMapAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceStructConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceStructConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceStructConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceStructConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.StructConverter
+ */
+public final class SourceStructConverterAnnotation
+ extends SourceNamedConverterAnnotation
+ implements StructConverterAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter CONVERTER_ADAPTER = buildConverterAdapter();
+ private final AnnotationElementAdapter converterAdapter;
+ private String converter;
+
+
+ public SourceStructConverterAnnotation(JavaResourcePersistentMember parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.converterAdapter = new ShortCircuitAnnotationElementAdapter(member, CONVERTER_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.converter = this.buildConverter(astRoot);
+ }
+
+ @Override
+ public void update(CompilationUnit astRoot) {
+ super.update(astRoot);
+ this.setConverter(this.buildConverter(astRoot));
+ }
+
+
+ // ********** SourceNamedConverterAnnotation implementation **********
+
+ @Override
+ String getNameElementName() {
+ return EclipseLinkJPA.STRUCT_CONVERTER__NAME;
+ }
+
+
+ // ********** StructConverterAnnotation implementation **********
+
+ // ***** converter
+ public String getConverter() {
+ return this.converter;
+ }
+
+ public void setConverter(String converter) {
+ if (this.attributeValueHasNotChanged(this.converter, converter)) {
+ return;
+ }
+ String old = this.converter;
+ this.converter = converter;
+ this.converterAdapter.setValue(converter);
+ this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
+ }
+
+ private String buildConverter(CompilationUnit astRoot) {
+ return this.converterAdapter.getValue(astRoot);
+ }
+
+ public TextRange getConverterTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(CONVERTER_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildConverterAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.STRUCT_CONVERTER__CONVERTER, false, StringExpressionConverter.instance());
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadTransformerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadTransformerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadTransformerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryReadTransformerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.ReadTransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadTransformer
+ */
+public final class BinaryReadTransformerAnnotation
+ extends BinaryTransformerAnnotation
+ implements ReadTransformerAnnotation
+{
+
+ public BinaryReadTransformerAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ // ********** BinaryTransformerAnnotation implementation **********
+
+ @Override
+ String getTransformerClassElementName() {
+ return EclipseLinkJPA.READ_TRANSFORMER__TRANSFORMER_CLASS;
+ }
+
+ @Override
+ String getMethodElementName() {
+ return EclipseLinkJPA.READ_TRANSFORMER__METHOD;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCacheAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCacheAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCacheAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceCacheAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,411 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType;
+import org.eclipse.jpt.eclipselink.core.resource.java.CacheType;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Cache
+ */
+public final class SourceCacheAnnotation
+ extends SourceAnnotation
+ implements CacheAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter TYPE_ADAPTER = buildTypeAdapter();
+ private final AnnotationElementAdapter typeAdapter;
+ private CacheType type;
+
+ private static final DeclarationAnnotationElementAdapter SIZE_ADAPTER = buildSizeAdapter();
+ private final AnnotationElementAdapter sizeAdapter;
+ private Integer size;
+
+ private static final DeclarationAnnotationElementAdapter SHARED_ADAPTER = buildSharedAdapter();
+ private final AnnotationElementAdapter sharedAdapter;
+ private Boolean shared;
+
+ private static final DeclarationAnnotationElementAdapter EXPIRY_ADAPTER = buildExpiryAdapter();
+ private final AnnotationElementAdapter expiryAdapter;
+ private Integer expiry;
+
+ private static final DeclarationAnnotationElementAdapter ALWAYS_REFRESH_ADAPTER = buildAlwaysRefreshAdapter();
+ private final AnnotationElementAdapter alwaysRefreshAdapter;
+ private TimeOfDayAnnotation expiryTimeOfDay;
+
+ private static final DeclarationAnnotationElementAdapter REFRESH_ONLY_IF_NEWER_ADAPTER = buildRefreshOnlyIfNewerAdapter();
+ private final AnnotationElementAdapter refreshOnlyIfNewerAdapter;
+ private Boolean alwaysRefresh;
+
+ private static final DeclarationAnnotationElementAdapter DISABLE_HITS_ADAPTER = buildDisableHitsAdapter();
+ private final AnnotationElementAdapter disableHitsAdapter;
+ private Boolean refreshOnlyIfNewer;
+
+ private static final DeclarationAnnotationElementAdapter COORDINATION_TYPE_ADAPTER = buildCoordinationTypeAdapter();
+ private final AnnotationElementAdapter coordinationTypeAdapter;
+ private Boolean disableHits;
+
+ private static final NestedDeclarationAnnotationAdapter EXPIRY_TIME_OF_DAY_ADAPTER = buildExpiryTimeOfDayAdapter();
+ private final MemberAnnotationAdapter expiryTimeOfDayAdapter;
+ private CacheCoordinationType coordinationType;
+
+
+ public SourceCacheAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.typeAdapter = new ShortCircuitAnnotationElementAdapter(type, TYPE_ADAPTER);
+ this.sizeAdapter = new ShortCircuitAnnotationElementAdapter(type, SIZE_ADAPTER);
+ this.sharedAdapter = new ShortCircuitAnnotationElementAdapter(type, SHARED_ADAPTER);
+ this.expiryAdapter = new ShortCircuitAnnotationElementAdapter(type, EXPIRY_ADAPTER);
+ this.alwaysRefreshAdapter = new ShortCircuitAnnotationElementAdapter(type, ALWAYS_REFRESH_ADAPTER);
+ this.refreshOnlyIfNewerAdapter = new ShortCircuitAnnotationElementAdapter(type, REFRESH_ONLY_IF_NEWER_ADAPTER);
+ this.disableHitsAdapter = new ShortCircuitAnnotationElementAdapter(type, DISABLE_HITS_ADAPTER);
+ this.coordinationTypeAdapter = new ShortCircuitAnnotationElementAdapter(type, COORDINATION_TYPE_ADAPTER);
+ this.expiryTimeOfDayAdapter = new MemberAnnotationAdapter(type, EXPIRY_TIME_OF_DAY_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.type = this.buildType(astRoot);
+ this.size = this.buildSize(astRoot);
+ this.shared = this.buildShared(astRoot);
+ this.expiry = this.buildExpiry(astRoot);
+ this.initializeExpiryTimeOfDay(astRoot);
+ this.alwaysRefresh = this.buildAlwaysRefresh(astRoot);
+ this.refreshOnlyIfNewer = this.buildRefreshOnlyIfNewer(astRoot);
+ this.disableHits = this.buildDisableHits(astRoot);
+ this.coordinationType = this.buildCoordinationType(astRoot);
+ }
+
+ private void initializeExpiryTimeOfDay(CompilationUnit astRoot) {
+ if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) != null) {
+ this.expiryTimeOfDay = this.buildExpiryTimeOfDay();
+ this.expiryTimeOfDay.initialize(astRoot);
+ }
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setType(this.buildType(astRoot));
+ this.setSize(this.buildSize(astRoot));
+ this.setShared(this.buildShared(astRoot));
+ this.setExpiry(this.buildExpiry(astRoot));
+ this.updateExpiryTimeOfDay(astRoot);
+ this.setAlwaysRefresh(this.buildAlwaysRefresh(astRoot));
+ this.setRefreshOnlyIfNewer(this.buildRefreshOnlyIfNewer(astRoot));
+ this.setDisableHits(this.buildDisableHits(astRoot));
+ this.setCoordinationType(this.buildCoordinationType(astRoot));
+ }
+
+ private void updateExpiryTimeOfDay(CompilationUnit astRoot) {
+ if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) == null) {
+ this.setExpiryTimeOfDay(null);
+ } else {
+ if (this.getExpiryTimeOfDay() == null) {
+ TimeOfDayAnnotation etod = this.buildExpiryTimeOfDay();
+ etod.initialize(astRoot);
+ this.setExpiryTimeOfDay(etod);
+ } else {
+ this.getExpiryTimeOfDay().update(astRoot);
+ }
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.type);
+ }
+
+
+ // ********** CacheAnnotation implementation **********
+
+ // ***** type
+ public CacheType getType() {
+ return this.type;
+ }
+
+ public void setType(CacheType type) {
+ if (this.attributeValueHasNotChanged(this.type, type)) {
+ return;
+ }
+ CacheType old = this.type;
+ this.type = type;
+ this.typeAdapter.setValue(CacheType.toJavaAnnotationValue(type));
+ this.firePropertyChanged(TYPE_PROPERTY, old, type);
+ }
+
+ private CacheType buildType(CompilationUnit astRoot) {
+ return CacheType.fromJavaAnnotationValue(this.typeAdapter.getValue(astRoot));
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(TYPE_ADAPTER, astRoot);
+ }
+
+ // ***** size
+ public Integer getSize() {
+ return this.size;
+ }
+
+ public void setSize(Integer size) {
+ if (this.attributeValueHasNotChanged(this.size, size)) {
+ return;
+ }
+ Integer old = this.size;
+ this.size = size;
+ this.sizeAdapter.setValue(size);
+ this.firePropertyChanged(SIZE_PROPERTY, old, size);
+ }
+
+ private Integer buildSize(CompilationUnit astRoot) {
+ return this.sizeAdapter.getValue(astRoot);
+ }
+
+ public TextRange getSizeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(SIZE_ADAPTER, astRoot);
+ }
+
+ // ***** shared
+ public Boolean getShared() {
+ return this.shared;
+ }
+
+ public void setShared(Boolean shared) {
+ if (this.attributeValueHasNotChanged(this.shared, shared)) {
+ return;
+ }
+ Boolean old = this.shared;
+ this.shared = shared;
+ this.sharedAdapter.setValue(shared);
+ this.firePropertyChanged(SHARED_PROPERTY, old, shared);
+ }
+
+ private Boolean buildShared(CompilationUnit astRoot) {
+ return this.sharedAdapter.getValue(astRoot);
+ }
+
+ public TextRange getSharedTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(SHARED_ADAPTER, astRoot);
+ }
+
+ // ***** expiry
+ public Integer getExpiry() {
+ return this.expiry;
+ }
+
+ public void setExpiry(Integer expiry) {
+ if (this.attributeValueHasNotChanged(this.expiry, expiry)) {
+ return;
+ }
+ Integer old = this.expiry;
+ this.expiry = expiry;
+ this.expiryAdapter.setValue(expiry);
+ this.firePropertyChanged(EXPIRY_PROPERTY, old, expiry);
+ }
+
+ private Integer buildExpiry(CompilationUnit astRoot) {
+ return this.expiryAdapter.getValue(astRoot);
+ }
+
+ public TextRange getExpiryTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(EXPIRY_ADAPTER, astRoot);
+ }
+
+ // ***** expiry time of day
+ public TimeOfDayAnnotation getExpiryTimeOfDay() {
+ return this.expiryTimeOfDay;
+ }
+
+ public TimeOfDayAnnotation addExpiryTimeOfDay() {
+ if (this.expiryTimeOfDay != null) {
+ throw new IllegalStateException("'expiryTimeOfDay' element already exists"); //$NON-NLS-1$
+ }
+ this.expiryTimeOfDay = this.buildExpiryTimeOfDay();
+ this.expiryTimeOfDayAdapter.newMarkerAnnotation();
+ this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, null, this.expiryTimeOfDay);
+ return this.expiryTimeOfDay;
+ }
+
+ public void removeExpiryTimeOfDay() {
+ if (this.expiryTimeOfDay == null) {
+ throw new IllegalStateException("No expiryTimeOfDay element exists"); //$NON-NLS-1$
+ }
+ this.expiryTimeOfDay = null;
+ this.expiryTimeOfDayAdapter.removeAnnotation();
+ this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, this.expiryTimeOfDay, null);
+ }
+
+ private void setExpiryTimeOfDay(TimeOfDayAnnotation expiryTimeOfDay) {
+ TimeOfDayAnnotation old = this.expiryTimeOfDay;
+ this.expiryTimeOfDay = expiryTimeOfDay;
+ this.firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, old, expiryTimeOfDay);
+ }
+
+ private TimeOfDayAnnotation buildExpiryTimeOfDay() {
+ return new SourceTimeOfDayAnnotation(this, this.member, EXPIRY_TIME_OF_DAY_ADAPTER);
+ }
+
+ public TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot) {
+ return null;//TODO return this.getElementTextRange(EXPIRY_TIME_OF_DAY_ADAPTER, astRoot);
+ }
+
+ // ***** always refresh
+ public Boolean getAlwaysRefresh() {
+ return this.alwaysRefresh;
+ }
+
+ public void setAlwaysRefresh(Boolean alwaysRefresh) {
+ if (this.attributeValueHasNotChanged(this.alwaysRefresh, alwaysRefresh)) {
+ return;
+ }
+ Boolean old = this.alwaysRefresh;
+ this.alwaysRefresh = alwaysRefresh;
+ this.alwaysRefreshAdapter.setValue(alwaysRefresh);
+ this.firePropertyChanged(ALWAYS_REFRESH_PROPERTY, old, alwaysRefresh);
+ }
+
+ private Boolean buildAlwaysRefresh(CompilationUnit astRoot) {
+ return this.alwaysRefreshAdapter.getValue(astRoot);
+ }
+
+ public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(ALWAYS_REFRESH_ADAPTER, astRoot);
+ }
+
+ // ***** refresh only if newer
+ public Boolean getRefreshOnlyIfNewer() {
+ return this.refreshOnlyIfNewer;
+ }
+
+ public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) {
+ if (this.attributeValueHasNotChanged(this.refreshOnlyIfNewer, refreshOnlyIfNewer)) {
+ return;
+ }
+ Boolean old = this.refreshOnlyIfNewer;
+ this.refreshOnlyIfNewer = refreshOnlyIfNewer;
+ this.refreshOnlyIfNewerAdapter.setValue(refreshOnlyIfNewer);
+ this.firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, old, refreshOnlyIfNewer);
+ }
+
+ private Boolean buildRefreshOnlyIfNewer(CompilationUnit astRoot) {
+ return this.refreshOnlyIfNewerAdapter.getValue(astRoot);
+ }
+
+ public TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(REFRESH_ONLY_IF_NEWER_ADAPTER, astRoot);
+ }
+
+ // ***** disable hits
+ public Boolean getDisableHits() {
+ return this.disableHits;
+ }
+
+ public void setDisableHits(Boolean disableHits) {
+ if (this.attributeValueHasNotChanged(this.disableHits, disableHits)) {
+ return;
+ }
+ Boolean old = this.disableHits;
+ this.disableHits = disableHits;
+ this.disableHitsAdapter.setValue(disableHits);
+ this.firePropertyChanged(DISABLE_HITS_PROPERTY, old, disableHits);
+ }
+
+ private Boolean buildDisableHits(CompilationUnit astRoot) {
+ return this.disableHitsAdapter.getValue(astRoot);
+ }
+
+ public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(DISABLE_HITS_ADAPTER, astRoot);
+ }
+
+ // ***** coordination type
+ public CacheCoordinationType getCoordinationType() {
+ return this.coordinationType;
+ }
+
+ public void setCoordinationType(CacheCoordinationType coordinationType) {
+ if (this.attributeValueHasNotChanged(this.coordinationType, coordinationType)) {
+ return;
+ }
+ CacheCoordinationType old = this.coordinationType;
+ this.coordinationType = coordinationType;
+ this.coordinationTypeAdapter.setValue(CacheCoordinationType.toJavaAnnotationValue(coordinationType));
+ this.firePropertyChanged(TYPE_PROPERTY, old, coordinationType);
+ }
+
+ private CacheCoordinationType buildCoordinationType(CompilationUnit astRoot) {
+ return CacheCoordinationType.fromJavaAnnotationValue(this.coordinationTypeAdapter.getValue(astRoot));
+ }
+
+ public TextRange getCoordinationTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(COORDINATION_TYPE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildTypeAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__TYPE);
+ }
+
+ private static DeclarationAnnotationElementAdapter buildSizeAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__SIZE, NumberIntegerExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildSharedAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__SHARED, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildExpiryAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__EXPIRY, NumberIntegerExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildAlwaysRefreshAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__ALWAYS_REFRESH, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildRefreshOnlyIfNewerAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__REFRESH_ONLY_IF_NEWER, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildDisableHitsAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__DISABLE_HITS, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildCoordinationTypeAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__COORDINATION_TYPE);
+ }
+
+ private static NestedDeclarationAnnotationAdapter buildExpiryTimeOfDayAdapter() {
+ return new NestedDeclarationAnnotationAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__EXPIRY_TIME_OF_DAY, EclipseLinkJPA.TIME_OF_DAY);
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryChangeTrackingAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryChangeTrackingAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryChangeTrackingAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryChangeTrackingAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.ChangeTracking
+ */
+public final class BinaryChangeTrackingAnnotation
+ extends BinaryAnnotation
+ implements ChangeTrackingAnnotation
+{
+ private ChangeTrackingType value;
+
+
+ public BinaryChangeTrackingAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // TODO
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** ChangeTrackingAnnotation implementation **********
+
+ // ***** value
+ public ChangeTrackingType getValue() {
+ return this.value;
+ }
+
+ public void setValue(ChangeTrackingType value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(ChangeTrackingType value) {
+ ChangeTrackingType old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private ChangeTrackingType buildValue() {
+ return ChangeTrackingType.fromJavaAnnotationValue(this.getJdtMemberValue(EclipseLinkJPA.CHANGE_TRACKING__VALUE));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConversionValueAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConversionValueAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConversionValueAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryConversionValueAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.ConversionValue
+ */
+final class BinaryConversionValueAnnotation
+ extends BinaryAnnotation
+ implements ConversionValueAnnotation
+{
+ private String dataValue;
+ private String objectValue;
+
+
+ BinaryConversionValueAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.dataValue = this.buildDataValue();
+ this.objectValue = this.buildObjectValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setDataValue_(this.buildDataValue());
+ this.setObjectValue_(this.buildObjectValue());
+ }
+
+
+ // ********** ConversionValueAnnotation implementation **********
+
+ // ***** data value
+ public String getDataValue() {
+ return this.dataValue;
+ }
+
+ public void setDataValue(String dataValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDataValue_(String dataValue) {
+ String old = this.dataValue;
+ this.dataValue = dataValue;
+ this.firePropertyChanged(DATA_VALUE_PROPERTY, old, dataValue);
+ }
+
+ private String buildDataValue() {
+ return (String) this.getJdtMemberValue(EclipseLinkJPA.CONVERSION_VALUE__DATA_VALUE);
+ }
+
+ public TextRange getDataValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** object value
+ public String getObjectValue() {
+ return this.objectValue;
+ }
+
+ public void setObjectValue(String objectValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setObjectValue_(String objectValue) {
+ String old = this.objectValue;
+ this.objectValue = objectValue;
+ this.firePropertyChanged(OBJECT_VALUE_PROPERTY, old, objectValue);
+ }
+
+ private String buildObjectValue() {
+ return (String) this.getJdtMemberValue(EclipseLinkJPA.CONVERSION_VALUE__OBJECT_VALUE);
+ }
+
+ public TextRange getObjectValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceNamedConverterAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceNamedConverterAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceNamedConverterAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceNamedConverterAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.OverrideAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.resource.java.NamedConverterAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Converter
+ * org.eclipse.persistence.annotations.StructConverter
+ * org.eclipse.persistence.annotations.TypeConverter
+ * org.eclipse.persistence.annotations.ObjectTypeConverter
+ */
+abstract class SourceNamedConverterAnnotation
+ extends SourceAnnotation
+ implements NamedConverterAnnotation
+{
+ final DeclarationAnnotationElementAdapter nameDeclarationAdapter;
+ final AnnotationElementAdapter nameAdapter;
+ String name;
+
+
+ // ********** construction/initialization **********
+
+ SourceNamedConverterAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ this.nameDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, this.getNameElementName(), false); // false = do not remove annotation when empty
+ this.nameAdapter = new ShortCircuitAnnotationElementAdapter(this.member, this.nameDeclarationAdapter);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setName(this.buildName(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+
+ // ********** NamedConverterAnnotation implementation **********
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasNotChanged(this.name, name)) {
+ return;
+ }
+ String old = this.name;
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ this.firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, old, name);
+ }
+
+ private String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
+ }
+
+ abstract String getNameElementName();
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformerAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformerAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformerAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformerAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.TransformerAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.ReadTransformer
+ * org.eclipse.persistence.annotations.WriteTransformer
+ */
+abstract class SourceTransformerAnnotation
+ extends SourceAnnotation
+ implements TransformerAnnotation
+{
+ final DeclarationAnnotationElementAdapter transformerClassDeclarationAdapter;
+ final AnnotationElementAdapter transformerClassAdapter;
+ String transformerClass;
+
+ final DeclarationAnnotationElementAdapter methodDeclarationAdapter;
+ final AnnotationElementAdapter methodAdapter;
+ String method;
+
+
+ SourceTransformerAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
+ super(parent, attribute, daa);
+ this.transformerClassDeclarationAdapter = new ConversionDeclarationAnnotationElementAdapter(daa, this.getTransformerClassElementName(), false, SimpleTypeStringExpressionConverter.instance());
+ this.transformerClassAdapter = new ShortCircuitAnnotationElementAdapter(attribute, this.transformerClassDeclarationAdapter);
+
+ this.methodDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, this.getMethodElementName(), false);
+ this.methodAdapter = new ShortCircuitAnnotationElementAdapter(attribute, this.methodDeclarationAdapter);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.transformerClass = this.buildTransformerClass(astRoot);
+ this.method = this.buildMethod(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setTransformerClass(this.buildTransformerClass(astRoot));
+ this.setMethod(this.buildMethod(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.transformerClass);
+ }
+
+
+ // ********** TransformerAnnotation implementation **********
+
+ // ***** transformer class
+ public String getTransformerClass() {
+ return this.transformerClass;
+ }
+
+ public void setTransformerClass(String transformerClass) {
+ if (this.attributeValueHasNotChanged(this.transformerClass, transformerClass)) {
+ return;
+ }
+ String old = this.transformerClass;
+ this.transformerClass = transformerClass;
+ this.transformerClassAdapter.setValue(transformerClass);
+ this.firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, old, transformerClass);
+ }
+
+ private String buildTransformerClass(CompilationUnit astRoot) {
+ return this.transformerClassAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTransformerClassTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.transformerClassDeclarationAdapter, astRoot);
+ }
+
+ abstract String getTransformerClassElementName();
+
+ // ***** method
+ public String getMethod() {
+ return this.method;
+ }
+
+ public void setMethod(String method) {
+ if (this.attributeValueHasNotChanged(this.method, method)) {
+ return;
+ }
+ String old = this.method;
+ this.method = method;
+ this.methodAdapter.setValue(method);
+ this.firePropertyChanged(METHOD_PROPERTY, old, method);
+ }
+
+ private String buildMethod(CompilationUnit astRoot) {
+ return this.methodAdapter.getValue(astRoot);
+ }
+
+ public TextRange getMethodTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(this.methodDeclarationAdapter, astRoot);
+ }
+
+ abstract String getMethodElementName();
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConvertAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConvertAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConvertAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceConvertAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+
+/**
+ * org.eclipse.persistence.annotations.Convert
+ */
+public final class SourceConvertAnnotation
+ extends SourceAnnotation
+ implements ConvertAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter valueAdapter;
+ private String value;
+
+
+ public SourceConvertAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter(attribute, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** ConvertAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ String old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERT__VALUE, false, StringExpressionConverter.instance());
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformationAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformationAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformationAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/source/SourceTransformationAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.eclipselink.core.internal.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.FetchType;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Transformation
+ */
+public final class SourceTransformationAnnotation
+ extends SourceAnnotation
+ implements TransformationAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter FETCH_ADAPTER = buildFetchAdapter();
+ private final AnnotationElementAdapter fetchAdapter;
+ private FetchType fetch;
+
+ private static final DeclarationAnnotationElementAdapter OPTIONAL_ADAPTER = buildOptionalAdapter();
+ private final AnnotationElementAdapter optionalAdapter;
+ private Boolean optional;
+
+
+ public SourceTransformationAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.fetchAdapter = new ShortCircuitAnnotationElementAdapter(attribute, FETCH_ADAPTER);
+ this.optionalAdapter = new ShortCircuitAnnotationElementAdapter(attribute, OPTIONAL_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.optional = this.buildOptional(astRoot);
+ this.fetch = this.buildFetch(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setOptional(this.buildOptional(astRoot));
+ this.setFetch(this.buildFetch(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.fetch);
+ }
+
+
+ // ********** TransformationAnnotation implementation **********
+
+ // ***** fetch
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType fetch) {
+ if (this.attributeValueHasNotChanged(this.fetch, fetch)) {
+ return;
+ }
+ FetchType old = this.fetch;
+ this.fetch = fetch;
+ this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
+ this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
+ }
+
+ private FetchType buildFetch(CompilationUnit astRoot) {
+ return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
+ }
+
+ public TextRange getFetchTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(FETCH_ADAPTER, astRoot);
+ }
+
+ // ***** optional
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean optional) {
+ if (this.attributeValueHasNotChanged(this.optional, optional)) {
+ return;
+ }
+ Boolean old = this.optional;
+ this.optional = optional;
+ this.optionalAdapter.setValue(optional);
+ this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
+ }
+
+ private Boolean buildOptional(CompilationUnit astRoot) {
+ return this.optionalAdapter.getValue(astRoot);
+ }
+
+ public TextRange getOptionalTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter buildOptionalAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TRANSFORMATION__OPTIONAL, false, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter buildFetchAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TRANSFORMATION__FETCH, false);
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryMutableAnnotation.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryMutableAnnotation.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryMutableAnnotation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/binary/BinaryMutableAnnotation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA;
+import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Mutable
+ */
+public final class BinaryMutableAnnotation
+ extends BinaryAnnotation
+ implements MutableAnnotation
+{
+ private Boolean value;
+
+
+ public BinaryMutableAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** MutableAnnotation implementation **********
+
+ // ***** value
+ public Boolean getValue() {
+ return this.value;
+ }
+
+ public void setValue(Boolean value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(Boolean value) {
+ Boolean old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private Boolean buildValue() {
+ return (Boolean) this.getJdtMemberValue(EclipseLinkJPA.MUTABLE__VALUE);
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryMutableAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceMutableAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Mutable
+ */
+public class MutableAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new MutableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private MutableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceMutableAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryMutableAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return MutableAnnotation.ANNOTATION_NAME;
+ }
+
+}
Index: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationAnnotationDefinition.java
===================================================================
RCS file: src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationAnnotationDefinition.java
diff -N src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationAnnotationDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationAnnotationDefinition.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.eclipselink.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+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.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.binary.BinaryTransformationAnnotation;
+import org.eclipse.jpt.eclipselink.core.internal.resource.java.source.SourceTransformationAnnotation;
+import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation;
+
+/**
+ * org.eclipse.persistence.annotations.Transformation
+ */
+public class TransformationAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new TransformationAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private TransformationAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceTransformationAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ return new NullTransformationAnnotation((JavaResourcePersistentAttribute) parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryTransformationAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return TransformationAnnotation.ANNOTATION_NAME;
+ }
+
+}
#P org.eclipse.jpt.utility
Index: src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java,v
retrieving revision 1.2
diff -u -r1.2 CompositeListIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java 3 Feb 2008 16:40:51 -0000 1.2
+++ src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java 8 Apr 2009 15:52:07 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2009 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.
@@ -9,9 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.iterators;
+import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
+
import org.eclipse.jpt.utility.internal.StringTools;
/**
@@ -34,10 +36,17 @@
/**
- * Construct a list iterator with the specified list of list iterators.
+ * Construct a list iterator on the elements in the specified list of lists.
*/
- public CompositeListIterator(List extends ListIterator> iterators) {
- this(iterators.listIterator());
+ public CompositeListIterator(List extends List> lists) {
+ this(
+ new TransformationListIterator, ListIterator>(lists.listIterator()) {
+ @Override
+ protected ListIterator transform(List list) {
+ return list.listIterator();
+ }
+ }
+ );
}
/**
@@ -52,6 +61,14 @@
/**
* Construct a list iterator with the specified object prepended
+ * to the specified list.
+ */
+ public CompositeListIterator(E object, List list) {
+ this(object, list.listIterator());
+ }
+
+ /**
+ * Construct a list iterator with the specified object prepended
* to the specified iterator.
*/
@SuppressWarnings("unchecked")
@@ -61,6 +78,14 @@
/**
* Construct a list iterator with the specified object appended
+ * to the specified list.
+ */
+ public CompositeListIterator(List list, E object) {
+ this(list.listIterator(), object);
+ }
+
+ /**
+ * Construct a list iterator with the specified object appended
* to the specified iterator.
*/
@SuppressWarnings("unchecked")
@@ -69,6 +94,13 @@
}
/**
+ * Construct a list iterator with the specified lists.
+ */
+ public CompositeListIterator(List... lists) {
+ this(Arrays.asList(lists));
+ }
+
+ /**
* Construct a list iterator with the specified list iterators.
*/
public CompositeListIterator(ListIterator... iterators) {
Index: src/org/eclipse/jpt/utility/internal/iterators/PeekableIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/PeekableIterator.java,v
retrieving revision 1.1
diff -u -r1.1 PeekableIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/PeekableIterator.java 25 Apr 2007 20:34:50 -0000 1.1
+++ src/org/eclipse/jpt/utility/internal/iterators/PeekableIterator.java 8 Apr 2009 15:52:07 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2009 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.
@@ -30,18 +30,26 @@
public class PeekableIterator
implements Iterator
{
- private final Iterator extends E> nestedIterator;
+ private final Iterator extends E> iterator;
private E next;
private boolean done;
/**
+ * Construct a peekable iterator that wraps the specified
+ * iterable.
+ */
+ public PeekableIterator(Iterable extends E> iterable) {
+ this(iterable.iterator());
+ }
+
+ /**
* Construct a peekable iterator that wraps the specified nested
* iterator.
*/
- public PeekableIterator(Iterator extends E> nestedIterator) {
+ public PeekableIterator(Iterator extends E> iterator) {
super();
- this.nestedIterator = nestedIterator;
+ this.iterator = iterator;
this.done = false;
this.loadNext();
}
@@ -84,8 +92,8 @@
* iterator. If there are none, next is set to END.
*/
private void loadNext() {
- if (this.nestedIterator.hasNext()) {
- this.next = this.nestedIterator.next();
+ if (this.iterator.hasNext()) {
+ this.next = this.iterator.next();
} else {
this.next = null;
this.done = true;
@@ -94,7 +102,7 @@
@Override
public String toString() {
- return StringTools.buildToStringFor(this, this.nestedIterator);
+ return StringTools.buildToStringFor(this, this.iterator);
}
}
Index: src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java,v
retrieving revision 1.2
diff -u -r1.2 ReadOnlyIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java 6 Apr 2009 18:14:30 -0000 1.2
+++ src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyIterator.java 8 Apr 2009 15:52:07 -0000
@@ -20,7 +20,7 @@
public class ReadOnlyIterator
implements Iterator
{
- private final Iterator extends E> nestedIterator;
+ private final Iterator extends E> iterator;
/**
* Construct an iterator on the specified collection that
@@ -34,19 +34,19 @@
* Construct an iterator with the specified nested iterator
* and disallow removes.
*/
- public ReadOnlyIterator(Iterator extends E> nestedIterator) {
+ public ReadOnlyIterator(Iterator extends E> iterator) {
super();
- this.nestedIterator = nestedIterator;
+ this.iterator = iterator;
}
public boolean hasNext() {
// delegate to the nested iterator
- return this.nestedIterator.hasNext();
+ return this.iterator.hasNext();
}
public E next() {
// delegate to the nested iterator
- return this.nestedIterator.next();
+ return this.iterator.next();
}
public void remove() {
@@ -55,7 +55,7 @@
@Override
public String toString() {
- return StringTools.buildToStringFor(this, this.nestedIterator);
+ return StringTools.buildToStringFor(this, this.iterator);
}
}
Index: src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyListIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyListIterator.java,v
retrieving revision 1.1
diff -u -r1.1 ReadOnlyListIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyListIterator.java 25 Apr 2007 20:34:50 -0000 1.1
+++ src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyListIterator.java 8 Apr 2009 15:52:08 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2009 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.
@@ -23,7 +23,7 @@
public class ReadOnlyListIterator
implements ListIterator
{
- private final ListIterator extends E> nestedListIterator;
+ private final ListIterator extends E> listIterator;
/**
@@ -38,39 +38,39 @@
* Construct an iterator on the specified list iterator that
* disallows removes, sets, and adds.
*/
- public ReadOnlyListIterator(ListIterator extends E> nestedListIterator) {
+ public ReadOnlyListIterator(ListIterator extends E> listIterator) {
super();
- this.nestedListIterator = nestedListIterator;
+ this.listIterator = listIterator;
}
public boolean hasNext() {
// delegate to the nested iterator
- return this.nestedListIterator.hasNext();
+ return this.listIterator.hasNext();
}
public E next() {
// delegate to the nested iterator
- return this.nestedListIterator.next();
+ return this.listIterator.next();
}
public boolean hasPrevious() {
// delegate to the nested iterator
- return this.nestedListIterator.hasPrevious();
+ return this.listIterator.hasPrevious();
}
public E previous() {
// delegate to the nested iterator
- return this.nestedListIterator.previous();
+ return this.listIterator.previous();
}
public int nextIndex() {
// delegate to the nested iterator
- return this.nestedListIterator.nextIndex();
+ return this.listIterator.nextIndex();
}
public int previousIndex() {
// delegate to the nested iterator
- return this.nestedListIterator.previousIndex();
+ return this.listIterator.previousIndex();
}
public void remove() {
@@ -87,7 +87,7 @@
@Override
public String toString() {
- return StringTools.buildToStringFor(this, this.nestedListIterator);
+ return StringTools.buildToStringFor(this, this.listIterator);
}
}
Index: src/org/eclipse/jpt/utility/internal/iterators/GenericIteratorWrapper.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/GenericIteratorWrapper.java,v
retrieving revision 1.3
diff -u -r1.3 GenericIteratorWrapper.java
--- src/org/eclipse/jpt/utility/internal/iterators/GenericIteratorWrapper.java 6 Apr 2009 18:14:30 -0000 1.3
+++ src/org/eclipse/jpt/utility/internal/iterators/GenericIteratorWrapper.java 8 Apr 2009 15:52:07 -0000
@@ -22,6 +22,11 @@
{
private final Iterator extends E> iterator;
+
+ public GenericIteratorWrapper(Iterable extends E> iterable) {
+ this(iterable.iterator());
+ }
+
public GenericIteratorWrapper(Iterator extends E> iterator) {
super();
this.iterator = iterator;
Index: src/org/eclipse/jpt/utility/internal/iterators/EmptyEnumeration.java
===================================================================
RCS file: src/org/eclipse/jpt/utility/internal/iterators/EmptyEnumeration.java
diff -N src/org/eclipse/jpt/utility/internal/iterators/EmptyEnumeration.java
--- src/org/eclipse/jpt/utility/internal/iterators/EmptyEnumeration.java 19 Jul 2007 16:38:27 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.utility.internal.iterators;
-
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * A NullEnumeration is just that.
- */
-public final class EmptyEnumeration
- implements Enumeration
-{
-
- // singleton
- @SuppressWarnings("unchecked")
- private static final EmptyEnumeration INSTANCE = new EmptyEnumeration();
-
- /**
- * Return the singleton.
- */
- @SuppressWarnings("unchecked")
- public static Enumeration instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private EmptyEnumeration() {
- super();
- }
-
- public boolean hasMoreElements() {
- return false;
- }
-
- public E nextElement() {
- throw new NoSuchElementException();
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
-
-}
Index: src/org/eclipse/jpt/utility/internal/iterators/TransformationListIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/TransformationListIterator.java,v
retrieving revision 1.2
diff -u -r1.2 TransformationListIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/TransformationListIterator.java 1 Nov 2007 16:12:25 -0000 1.2
+++ src/org/eclipse/jpt/utility/internal/iterators/TransformationListIterator.java 8 Apr 2009 15:52:08 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2009 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.
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.iterators;
+import java.util.List;
import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.Transformer;
@@ -25,59 +26,77 @@
public class TransformationListIterator
implements ListIterator
{
- private final ListIterator extends E1> nestedIterator;
+ private final ListIterator extends E1> listIterator;
private final Transformer transformer;
/**
- * Construct an iterator with the specified nested iterator
+ * Construct an iterator with the specified list
* and a disabled transformer.
* Use this constructor if you want to override the
* transform(Object) method instead of building
* a Transformer.
*/
- public TransformationListIterator(ListIterator extends E1> nestedIterator) {
- this(nestedIterator, Transformer.Disabled.instance());
+ public TransformationListIterator(List extends E1> list) {
+ this(list.listIterator());
+ }
+
+ /**
+ * Construct an iterator with the specified nested listed iterator
+ * and a disabled transformer.
+ * Use this constructor if you want to override the
+ * transform(Object) method instead of building
+ * a Transformer.
+ */
+ public TransformationListIterator(ListIterator extends E1> listIterator) {
+ this(listIterator, Transformer.Disabled.instance());
+ }
+
+ /**
+ * Construct an iterator with the specified list and transformer.
+ */
+ public TransformationListIterator(List extends E1> list, Transformer transformer) {
+ this(list.listIterator(), transformer);
}
/**
* Construct an iterator with the specified nested iterator
* and transformer.
*/
- public TransformationListIterator(ListIterator extends E1> nestedIterator, Transformer transformer) {
+ public TransformationListIterator(ListIterator extends E1> listIterator, Transformer transformer) {
super();
- this.nestedIterator = nestedIterator;
+ this.listIterator = listIterator;
this.transformer = transformer;
}
public boolean hasNext() {
// delegate to the nested iterator
- return this.nestedIterator.hasNext();
+ return this.listIterator.hasNext();
}
public E2 next() {
// transform the object returned by the nested iterator before returning it
- return this.transform(this.nestedIterator.next());
+ return this.transform(this.listIterator.next());
}
public int nextIndex() {
// delegate to the nested iterator
- return this.nestedIterator.nextIndex();
+ return this.listIterator.nextIndex();
}
public boolean hasPrevious() {
// delegate to the nested iterator
- return this.nestedIterator.hasPrevious();
+ return this.listIterator.hasPrevious();
}
public E2 previous() {
// transform the object returned by the nested iterator before returning it
- return this.transform(this.nestedIterator.previous());
+ return this.transform(this.listIterator.previous());
}
public int previousIndex() {
// delegate to the nested iterator
- return this.nestedIterator.previousIndex();
+ return this.listIterator.previousIndex();
}
public void add(E2 o) {
@@ -90,7 +109,7 @@
public void remove() {
// delegate to the nested iterator
- this.nestedIterator.remove();
+ this.listIterator.remove();
}
/**
@@ -102,7 +121,7 @@
@Override
public String toString() {
- return StringTools.buildToStringFor(this, this.nestedIterator);
+ return StringTools.buildToStringFor(this, this.listIterator);
}
}
Index: src/org/eclipse/jpt/utility/internal/iterators/IteratorEnumeration.java
===================================================================
RCS file: src/org/eclipse/jpt/utility/internal/iterators/IteratorEnumeration.java
diff -N src/org/eclipse/jpt/utility/internal/iterators/IteratorEnumeration.java
--- src/org/eclipse/jpt/utility/internal/iterators/IteratorEnumeration.java 25 Apr 2007 20:34:49 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.utility.internal.iterators;
-
-import java.util.Enumeration;
-import java.util.Iterator;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * An IteratorEnumeration wraps an
- * Iterator so that it can be treated like an
- * Enumeration.
- */
-public class IteratorEnumeration
- implements Enumeration
-{
- private final Iterator extends E> iterator;
-
- /**
- * Construct an enumeration that wraps the specified iterator.
- */
- public IteratorEnumeration(Iterator extends E> iterator) {
- super();
- this.iterator = iterator;
- }
-
- public boolean hasMoreElements() {
- return this.iterator.hasNext();
- }
-
- public E nextElement() {
- return this.iterator.next();
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.iterator);
- }
-
-}
Index: src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java,v
retrieving revision 1.6
diff -u -r1.6 FilteringIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java 2 Oct 2008 21:26:43 -0000 1.6
+++ src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java 8 Apr 2009 15:52:07 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2009 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.
@@ -36,30 +36,49 @@
public class FilteringIterator
implements Iterator
{
- private final Iterator extends E1> nestedIterator;
+ private final Iterator extends E1> iterator;
private final Filter filter;
private E2 next;
private boolean done;
/**
+ * Construct an iterator with the specified
+ * iterable and a disabled filter.
+ * Use this constructor if you want to override the
+ * accept(Object) method instead of building
+ * a Filter.
+ */
+ public FilteringIterator(Iterable extends E1> iterable) {
+ this(iterable.iterator());
+ }
+
+ /**
* Construct an iterator with the specified nested
* iterator and a disabled filter.
* Use this constructor if you want to override the
* accept(Object) method instead of building
* a Filter.
*/
- public FilteringIterator(Iterator extends E1> nestedIterator) {
- this(nestedIterator, Filter.Disabled.instance());
+ public FilteringIterator(Iterator extends E1> iterator) {
+ this(iterator, Filter.Disabled.instance());
+ }
+
+ /**
+ * Construct an iterator with the specified
+ * iterable and filter.
+ */
+ public FilteringIterator(Iterable extends E1> iterable, Filter filter) {
+ this(iterable.iterator(), filter);
}
/**
* Construct an iterator with the specified nested
* iterator and filter.
*/
- public FilteringIterator(Iterator extends E1> nestedIterator, Filter filter) {
+ public FilteringIterator(Iterator extends E1> iterator, Filter filter) {
super();
- this.nestedIterator = nestedIterator;
+ this.iterator = iterator;
this.filter = filter;
this.loadNext();
}
@@ -92,8 +111,8 @@
*/
private void loadNext() {
this.done = true;
- while (this.nestedIterator.hasNext() && (this.done)) {
- E1 temp = this.nestedIterator.next();
+ while (this.iterator.hasNext() && (this.done)) {
+ E1 temp = this.iterator.next();
if (this.accept(temp)) {
// assume that if the object was accepted it is of type E
this.next = this.cast(temp);
@@ -128,7 +147,7 @@
@Override
public String toString() {
- return StringTools.buildToStringFor(this, this.nestedIterator);
+ return StringTools.buildToStringFor(this, this.iterator);
}
}
Index: src/org/eclipse/jpt/utility/internal/iterators/GenericListIteratorWrapper.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/GenericListIteratorWrapper.java,v
retrieving revision 1.1
diff -u -r1.1 GenericListIteratorWrapper.java
--- src/org/eclipse/jpt/utility/internal/iterators/GenericListIteratorWrapper.java 6 Apr 2009 18:14:30 -0000 1.1
+++ src/org/eclipse/jpt/utility/internal/iterators/GenericListIteratorWrapper.java 8 Apr 2009 15:52:07 -0000
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.iterators;
+import java.util.List;
import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.StringTools;
@@ -24,6 +25,11 @@
{
private final ListIterator extends E> listIterator;
+
+ public GenericListIteratorWrapper(List extends E> list) {
+ this(list.listIterator());
+ }
+
public GenericListIteratorWrapper(ListIterator extends E> listIterator) {
super();
this.listIterator = listIterator;
Index: src/org/eclipse/jpt/utility/internal/iterators/TransformationIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/TransformationIterator.java,v
retrieving revision 1.2
diff -u -r1.2 TransformationIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/TransformationIterator.java 1 Nov 2007 16:12:25 -0000 1.2
+++ src/org/eclipse/jpt/utility/internal/iterators/TransformationIterator.java 8 Apr 2009 15:52:08 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2009 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.
@@ -25,44 +25,62 @@
public class TransformationIterator
implements Iterator
{
- private final Iterator extends E1> nestedIterator;
+ private final Iterator extends E1> iterator;
private final Transformer transformer;
/**
+ * Construct an iterator with the specified iterable
+ * and a disabled transformer.
+ * Use this constructor if you want to override the
+ * transform(Object) method instead of building
+ * a Transformer.
+ */
+ public TransformationIterator(Iterable extends E1> iterable) {
+ this(iterable.iterator());
+ }
+
+ /**
* Construct an iterator with the specified nested iterator
* and a disabled transformer.
* Use this constructor if you want to override the
* transform(Object) method instead of building
* a Transformer.
*/
- public TransformationIterator(Iterator extends E1> nestedIterator) {
- this(nestedIterator, Transformer.Disabled.instance());
+ public TransformationIterator(Iterator extends E1> iterator) {
+ this(iterator, Transformer.Disabled.instance());
+ }
+
+ /**
+ * Construct an iterator with the specified iterable and transformer.
+ */
+ public TransformationIterator(Iterable extends E1> iterable, Transformer transformer) {
+ this(iterable.iterator(), transformer);
}
/**
* Construct an iterator with the specified nested iterator
* and transformer.
*/
- public TransformationIterator(Iterator extends E1> nestedIterator, Transformer transformer) {
+ public TransformationIterator(Iterator extends E1> iterator, Transformer transformer) {
super();
- this.nestedIterator = nestedIterator;
+ this.iterator = iterator;
this.transformer = transformer;
}
public boolean hasNext() {
// delegate to the nested iterator
- return this.nestedIterator.hasNext();
+ return this.iterator.hasNext();
}
public E2 next() {
// transform the object returned by the nested iterator before returning it
- return this.transform(this.nestedIterator.next());
+ return this.transform(this.iterator.next());
}
public void remove() {
// delegate to the nested iterator
- this.nestedIterator.remove();
+ this.iterator.remove();
}
/**
@@ -74,7 +92,7 @@
@Override
public String toString() {
- return StringTools.buildToStringFor(this, this.nestedIterator);
+ return StringTools.buildToStringFor(this, this.iterator);
}
}
Index: src/org/eclipse/jpt/utility/internal/iterators/ArrayIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ArrayIterator.java,v
retrieving revision 1.2
diff -u -r1.2 ArrayIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/ArrayIterator.java 10 Feb 2009 22:34:30 -0000 1.2
+++ src/org/eclipse/jpt/utility/internal/iterators/ArrayIterator.java 8 Apr 2009 15:52:07 -0000
@@ -26,19 +26,21 @@
int nextIndex; // private-protected
private final int maxIndex;
+
/**
* Construct an iterator for the specified array.
*/
public ArrayIterator(E... array) {
this(array, 0, array.length);
}
-
+
/**
* Construct an iterator for the specified array,
* starting at the specified start index and continuing for
* the specified length.
*/
public ArrayIterator(E[] array, int start, int length) {
+ super();
if ((start < 0) || (start > array.length)) {
throw new IllegalArgumentException("start: " + start); //$NON-NLS-1$
}
@@ -49,25 +51,25 @@
this.nextIndex = start;
this.maxIndex = start + length;
}
-
+
public boolean hasNext() {
return this.nextIndex < this.maxIndex;
}
-
+
public E next() {
if (this.hasNext()) {
return this.array[this.nextIndex++];
}
throw new NoSuchElementException();
}
-
+
public void remove() {
throw new UnsupportedOperationException();
}
-
+
@Override
public String toString() {
return StringTools.buildToStringFor(this, Arrays.toString(this.array));
}
-
+
}
Index: src/org/eclipse/jpt/utility/internal/iterators/ArrayListIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ArrayListIterator.java,v
retrieving revision 1.1
diff -u -r1.1 ArrayListIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/ArrayListIterator.java 25 Apr 2007 20:34:50 -0000 1.1
+++ src/org/eclipse/jpt/utility/internal/iterators/ArrayListIterator.java 8 Apr 2009 15:52:07 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2009 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.
@@ -26,6 +26,7 @@
{
private final int minIndex;
+
/**
* Construct a list iterator for the specified array.
*/
Index: src/org/eclipse/jpt/utility/internal/iterators/GraphIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/GraphIterator.java,v
retrieving revision 1.3
diff -u -r1.3 GraphIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/GraphIterator.java 10 Feb 2009 22:33:56 -0000 1.3
+++ src/org/eclipse/jpt/utility/internal/iterators/GraphIterator.java 8 Apr 2009 15:52:07 -0000
@@ -9,18 +9,17 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.iterators;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.NoSuchElementException;
-import java.util.Set;
+
import org.eclipse.jpt.utility.internal.StringTools;
/**
* A GraphIterator is similar to a TreeIterator
* except that it cannot be assumed that all nodes assume a strict tree
- * structure. For instance, in a tree, a node cannot be a descendent of
+ * structure. For instance, in a tree, a node cannot be a descendent of
* itself, but a graph may have a cyclical structure.
*
* A GraphIterator simplifies the traversal of a
@@ -39,22 +38,22 @@
* It is up to the user of this class to ensure a *complete* graph.
*
* To use, supply:
- *
either the initial node of the graph or an Iterator over an
- * initial collection of graph nodes
+ *
either the initial node of the graph or an Iterator
+ * over an initial collection of graph nodes
*
a MisterRogers that tells who the neighbors are
* of each node
* (alternatively, subclass GraphIterator
* and override the neighbors(Object) method)
*
*
- * remove() is not supported. This method, if
+ * remove() is not supported. This method, if
* desired, must be implemented by the user of this class.
*/
public class GraphIterator
implements Iterator
{
- private final Collection> iterators;
- private final Set visitedNeighbors;
+ private final LinkedList> iterators;
+ private final HashSet visitedNeighbors;
private final MisterRogers misterRogers;
private Iterator extends E> currentIterator;
@@ -64,10 +63,11 @@
/**
- * Construct an iterator with the specified collection of roots
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified collection of roots
* and a disabled mister rogers.
* Use this constructor if you want to override the
- * children(Object) method instead of building
+ * neighbors(Object) method instead of building
* a MisterRogers.
*/
public GraphIterator(E... roots) {
@@ -75,10 +75,23 @@
}
/**
- * Construct an iterator with the specified collection of roots
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified collection of roots
+ * and a disabled mister rogers.
+ * Use this constructor if you want to override the
+ * neighbors(Object) method instead of building
+ * a MisterRogers.
+ */
+ public GraphIterator(Iterable extends E> roots) {
+ this(roots.iterator());
+ }
+
+ /**
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified collection of roots
* and a disabled mister rogers.
* Use this constructor if you want to override the
- * children(Object) method instead of building
+ * neighbors(Object) method instead of building
* a MisterRogers.
*/
public GraphIterator(Iterator extends E> roots) {
@@ -86,10 +99,11 @@
}
/**
- * Construct an iterator with the specified root
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified root
* and a disabled mister rogers.
* Use this constructor if you want to override the
- * children(Object) method instead of building
+ * neighbors(Object) method instead of building
* a MisterRogers.
*/
public GraphIterator(E root) {
@@ -97,16 +111,32 @@
}
/**
- * Construct an iterator with the specified root
- * and mister rogers.
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified root and mister rogers.
*/
public GraphIterator(E root, MisterRogers misterRogers) {
this(new SingleElementIterator(root), misterRogers);
}
/**
- * Construct an iterator with the specified roots
- * and mister rogers.
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified collection of roots and mister rogers.
+ */
+ public GraphIterator(E[] roots, MisterRogers misterRogers) {
+ this(new ArrayIterator(roots), misterRogers);
+ }
+
+ /**
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified roots and mister rogers.
+ */
+ public GraphIterator(Iterable extends E> roots, MisterRogers misterRogers) {
+ this(roots.iterator(), misterRogers);
+ }
+
+ /**
+ * Construct an iterator that returns the nodes of a graph
+ * with the specified roots and mister rogers.
*/
public GraphIterator(Iterator extends E> roots, MisterRogers misterRogers) {
super();
Index: src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java
===================================================================
RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java,v
retrieving revision 1.5
diff -u -r1.5 CloneIterator.java
--- src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java 6 Apr 2009 18:14:30 -0000 1.5
+++ src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java 8 Apr 2009 15:52:07 -0000
@@ -32,7 +32,7 @@
public class CloneIterator
implements Iterator
{
- private final Iterator