| /******************************************************************************* |
| * Copyright (c) 2008, 2011 Oracle. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v1.0, which accompanies this distribution |
| * and is available at http://www.eclipse.org/legal/epl-v10.html. |
| * |
| * Contributors: |
| * Oracle - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java; |
| |
| import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; |
| import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; |
| import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; |
| import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTransformationMapping; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.java.EclipseLinkJavaConvertibleMapping; |
| import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkTransformationAnnotation; |
| |
| public class JavaEclipseLinkTransformationMapping |
| extends AbstractJavaAttributeMapping<EclipseLinkTransformationAnnotation> |
| implements EclipseLinkTransformationMapping, EclipseLinkJavaConvertibleMapping |
| { |
| |
| protected final JavaEclipseLinkConverterContainer converterContainer; |
| |
| public JavaEclipseLinkTransformationMapping(JavaPersistentAttribute parent) { |
| super(parent); |
| this.converterContainer = this.buildConverterContainer(); |
| } |
| |
| |
| // ********** synchronize/update ********** |
| |
| @Override |
| public void synchronizeWithResourceModel() { |
| super.synchronizeWithResourceModel(); |
| this.converterContainer.synchronizeWithResourceModel(); |
| } |
| |
| @Override |
| public void update() { |
| super.update(); |
| this.converterContainer.update(); |
| } |
| |
| |
| // ********** converters ********** |
| |
| public JavaEclipseLinkConverterContainer getConverterContainer() { |
| return this.converterContainer; |
| } |
| |
| protected JavaEclipseLinkConverterContainer buildConverterContainer() { |
| return new JavaEclipseLinkConverterContainerImpl(this, this); |
| } |
| |
| public JavaResourceAnnotatedElement getJavaResourceAnnotatedElement() { |
| return this.getResourceAttribute(); |
| } |
| |
| |
| // ********** misc ********** |
| |
| public String getKey() { |
| return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; |
| } |
| |
| @Override |
| protected String getAnnotationName() { |
| return EclipseLinkTransformationAnnotation.ANNOTATION_NAME; |
| } |
| } |