Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2016-08-01 17:44:46 +0000
committerBrian Vosburgh2017-05-18 22:38:41 +0000
commitf2e3108d9493ec216df5b2d6ad6df478a2e05cfc (patch)
tree7057890bc643b05293d3d1d8efed61fbc949e069
parente5e6ed3bb88caa3e7c433ec4a9e2daf95615759b (diff)
downloadwebtools.dali-f2e3108d9493ec216df5b2d6ad6df478a2e05cfc.tar.gz
webtools.dali-f2e3108d9493ec216df5b2d6ad6df478a2e05cfc.tar.xz
webtools.dali-f2e3108d9493ec216df5b2d6ad6df478a2e05cfc.zip
refactor aspect adapters in EclipseLink JAXB plug-ins
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/TypeName.java39
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/ELJaxbPackage.java27
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmFile.java27
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmJavaAttribute.java36
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmTypeMapping.java28
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemContentProviderFactory.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemLabelProviderFactory.java104
8 files changed, 185 insertions, 113 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java
index f618521834..a7a83e375e 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2016 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,6 +30,15 @@ public interface JaxbAttributeMapping
extends JaxbContextNode {
String getKey();
+ Transformer<JaxbAttributeMapping, String> KEY_TRANSFORMER = new KeyTransformer();
+ class KeyTransformer
+ extends TransformerAdapter<JaxbAttributeMapping, String>
+ {
+ @Override
+ public String transform(JaxbAttributeMapping mapping) {
+ return mapping.getKey();
+ }
+ }
JaxbPersistentAttribute getPersistentAttribute();
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/TypeName.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/TypeName.java
index ec62eb5d78..b3c11daac1 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/TypeName.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/TypeName.java
@@ -1,13 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.context;
+ * Copyright (c) 2012, 2016 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jaxb.core.context;
+
+import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
/**
* Represents the name of a java type
@@ -38,10 +41,28 @@ public interface TypeName {
* enclosing types, but not including package qualification.
*/
String getTypeQualifiedName();
+ Transformer<TypeName, String> TYPE_QUALIFIED_NAME_TRANSFORMER = new TypeQualifiedNameTransformer();
+ class TypeQualifiedNameTransformer
+ extends TransformerAdapter<TypeName, String>
+ {
+ @Override
+ public String transform(TypeName model) {
+ return model.getTypeQualifiedName();
+ }
+ }
/**
* Returns the fully qualified name of this type, including qualification for any
* enclosing types and packages.
*/
String getFullyQualifiedName();
+ Transformer<TypeName, String> FULLY_QUALIFIED_NAME_TRANSFORMER = new FullyQualifiedNameTransformer();
+ class FullyQualifiedNameTransformer
+ extends TransformerAdapter<TypeName, String>
+ {
+ @Override
+ public String transform(TypeName model) {
+ return model.getFullyQualifiedName();
+ }
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/ELJaxbPackage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/ELJaxbPackage.java
index 2fc60c13eb..63a3bea258 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/ELJaxbPackage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/ELJaxbPackage.java
@@ -1,14 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2012 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) 2012, 2016 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.core.context;
+import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jaxb.core.context.JaxbPackage;
import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmFile;
@@ -23,4 +25,13 @@ public interface ELJaxbPackage
* May be null.
*/
OxmFile getOxmFile();
+ Transformer<ELJaxbPackage, OxmFile> OXM_FILE_TRANSFORMER = new OxmFileTransformer();
+ class OxmFileTransformer
+ extends TransformerAdapter<ELJaxbPackage, OxmFile>
+ {
+ @Override
+ public OxmFile transform(ELJaxbPackage pkg) {
+ return pkg.getOxmFile();
+ }
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmFile.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmFile.java
index a27f23a121..d669b68f10 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmFile.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmFile.java
@@ -1,15 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2012 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) 2012, 2016 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.core.context.oxm;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
+import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
import org.eclipse.jpt.jaxb.eclipselink.core.context.ELJaxbPackage;
@@ -48,4 +50,13 @@ public interface OxmFile
static final String XML_BINDINGS_PROPERTY = "xmlBindings"; //$NON-NLS-1$
OxmXmlBindings getXmlBindings();
+ Transformer<OxmFile, OxmXmlBindings> XML_BINDINGS_TRANSFORMER = new XmlBindingsTransformer();
+ class XmlBindingsTransformer
+ extends TransformerAdapter<OxmFile, OxmXmlBindings>
+ {
+ @Override
+ public OxmXmlBindings transform(OxmFile file) {
+ return file.getXmlBindings();
+ }
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmJavaAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmJavaAttribute.java
index 5477d1df9d..5a14a97b0a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmJavaAttribute.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmJavaAttribute.java
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2012 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) 2012, 2016 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.core.context.oxm;
-import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
-import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
-import org.eclipse.jpt.jaxb.core.context.XmlAccessTypeHolder;
+import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
+import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.core.context.XmlAccessTypeHolder;
import org.eclipse.jpt.jaxb.eclipselink.core.resource.oxm.EJavaAttribute;
/**
@@ -25,7 +26,7 @@ import org.eclipse.jpt.jaxb.eclipselink.core.resource.oxm.EJavaAttribute;
* @since 3.3
*/
public interface OxmJavaAttribute
- extends JaxbContextNode, JaxbPersistentAttribute, XmlAccessTypeHolder {
+ extends JaxbPersistentAttribute, XmlAccessTypeHolder {
EJavaAttribute getEJavaAttribute();
@@ -40,6 +41,15 @@ public interface OxmJavaAttribute
static final String JAVA_ATTRIBUTE_NAME_PROPERTY = "javaAttributeName"; //$NON-NLS-1$
String getJavaAttributeName();
+ Transformer<OxmJavaAttribute, String> JAVA_ATTRIBUTE_NAME_TRANSFORMER = new JavaAttributeNameTransformer();
+ class JavaAttributeNameTransformer
+ extends TransformerAdapter<OxmJavaAttribute, String>
+ {
+ @Override
+ public String transform(OxmJavaAttribute javaAttribute) {
+ return javaAttribute.getJavaAttributeName();
+ }
+ }
void setJavaAttributeName(String newName);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmTypeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmTypeMapping.java
index 4e2b5806b4..3f61778d44 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmTypeMapping.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/context/oxm/OxmTypeMapping.java
@@ -1,15 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2012 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) 2012, 2016 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.core.context.oxm;
+import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jaxb.core.context.JaxbTypeMapping;
+import org.eclipse.jpt.jaxb.core.context.TypeName;
import org.eclipse.jpt.jaxb.core.context.XmlRootElement;
import org.eclipse.jpt.jaxb.core.context.XmlSeeAlso;
import org.eclipse.jpt.jaxb.core.context.java.JavaType;
@@ -44,6 +47,15 @@ public interface OxmTypeMapping
// ***** type name *****
String TYPE_NAME_PROPERTY = "typeName"; //$NON-NLS-1$
+ Transformer<OxmTypeMapping, TypeName> TYPE_NAME_TRANSFORMER = new TypeNameTransformer();
+ class TypeNameTransformer
+ extends TransformerAdapter<OxmTypeMapping, TypeName>
+ {
+ @Override
+ public TypeName transform(OxmTypeMapping mapping) {
+ return mapping.getTypeName();
+ }
+ }
// ***** java type *****
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemContentProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemContentProviderFactory.java
index f6326f6b17..1e9f62af01 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemContentProviderFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemContentProviderFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2012, 2016 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.
@@ -22,8 +22,8 @@ import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValue
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListCollectionValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListCurator;
-import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.predicate.CriterionPredicate;
import org.eclipse.jpt.common.utility.internal.predicate.PredicateTools;
import org.eclipse.jpt.common.utility.iterable.ListIterable;
@@ -94,12 +94,11 @@ public class ELJaxbNavigatorItemContentProviderFactory
protected CollectionValueModel<JaxbContextNode> buildOxmFileChildrenModel(final ELJaxbPackage jaxbPackage) {
return new FilteringCollectionValueModel<JaxbContextNode>(
new PropertyCollectionValueModelAdapter<JaxbContextNode>(
- new PropertyAspectAdapterXXXX<ELJaxbPackage, JaxbContextNode>(ELJaxbPackage.OXM_FILE_PROPERTY, jaxbPackage) {
- @Override
- protected JaxbContextNode buildValue_() {
- return this.subject.getOxmFile();
- }
- }),
+ PropertyValueModelTools.modelAspectAdapter(
+ jaxbPackage,
+ ELJaxbPackage.OXM_FILE_PROPERTY,
+ ELJaxbPackage.OXM_FILE_TRANSFORMER
+ )),
PredicateTools.<JaxbContextNode>isNotNull());
}
@@ -170,12 +169,11 @@ public class ELJaxbNavigatorItemContentProviderFactory
}
protected PropertyValueModel<OxmXmlBindings> buildXmlBindingsModel(OxmFile oxmFile) {
- return new PropertyAspectAdapterXXXX<OxmFile, OxmXmlBindings>(OxmFile.XML_BINDINGS_PROPERTY, oxmFile) {
- @Override
- protected OxmXmlBindings buildValue_() {
- return this.subject.getXmlBindings();
- }
- };
+ return PropertyValueModelTools.modelAspectAdapter(
+ oxmFile,
+ OxmFile.XML_BINDINGS_PROPERTY,
+ OxmFile.XML_BINDINGS_TRANSFORMER
+ );
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemLabelProviderFactory.java
index d847627667..d8dae4d52c 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemLabelProviderFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/navigator/ELJaxbNavigatorItemLabelProviderFactory.java
@@ -14,10 +14,13 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jpt.common.ui.internal.jface.ModelItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.internal.jface.StaticItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
-import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
+import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
+import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping;
import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.core.context.TypeName;
import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmFile;
import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmJavaAttribute;
import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmJavaType;
@@ -100,8 +103,8 @@ public class ELJaxbNavigatorItemLabelProviderFactory
item,
manager,
this.buildOxmJavaTypeImageDescriptorModel(item),
- this.buildOxmJavaTypeTextModel(item),
- this.buildOxmJavaTypeDescriptionModel(item)
+ this.buildOxmTypeMappingTextModel(item),
+ this.buildOxmTypeMappingDescriptionModel(item)
);
}
@@ -109,22 +112,26 @@ public class ELJaxbNavigatorItemLabelProviderFactory
return PropertyValueModelTools.staticModel(JptJaxbUiImages.JAXB_CLASS);
}
- protected PropertyValueModel<String> buildOxmJavaTypeTextModel(OxmJavaType item) {
- return new PropertyAspectAdapterXXXX<OxmJavaType, String>(OxmTypeMapping.TYPE_NAME_PROPERTY, item) {
- @Override
- protected String buildValue_() {
- return this.subject.getTypeName().getTypeQualifiedName();
- }
- };
+ protected PropertyValueModel<String> buildOxmTypeMappingTextModel(OxmTypeMapping item) {
+ return PropertyValueModelTools.transform(
+ this.buildOxmTypeMappingNameModel(item),
+ TypeName.TYPE_QUALIFIED_NAME_TRANSFORMER
+ );
}
- protected PropertyValueModel<String> buildOxmJavaTypeDescriptionModel(OxmJavaType item) {
- return new PropertyAspectAdapterXXXX<OxmJavaType, String>(OxmTypeMapping.TYPE_NAME_PROPERTY, item) {
- @Override
- protected String buildValue_() {
- return this.subject.getTypeName().getFullyQualifiedName();
- }
- };
+ protected PropertyValueModel<String> buildOxmTypeMappingDescriptionModel(OxmTypeMapping item) {
+ return PropertyValueModelTools.transform(
+ this.buildOxmTypeMappingNameModel(item),
+ TypeName.FULLY_QUALIFIED_NAME_TRANSFORMER
+ );
+ }
+
+ protected PropertyValueModel<TypeName> buildOxmTypeMappingNameModel(OxmTypeMapping item) {
+ return PropertyValueModelTools.modelAspectAdapter(
+ item,
+ OxmTypeMapping.TYPE_NAME_PROPERTY,
+ OxmTypeMapping.TYPE_NAME_TRANSFORMER
+ );
}
@@ -135,33 +142,14 @@ public class ELJaxbNavigatorItemLabelProviderFactory
item,
manager,
this.buildOxmXmlEnumImageDescriptorModel(item),
- this.buildOxmXmlEnumTextModel(item),
- this.buildOxmXmlEnumDescriptionModel(item)
+ this.buildOxmTypeMappingTextModel(item),
+ this.buildOxmTypeMappingDescriptionModel(item)
);
}
protected PropertyValueModel<ImageDescriptor> buildOxmXmlEnumImageDescriptorModel(@SuppressWarnings("unused") OxmXmlEnum item) {
return PropertyValueModelTools.staticModel(JptJaxbUiImages.JAXB_ENUM);
}
-
- protected PropertyValueModel<String> buildOxmXmlEnumTextModel(OxmXmlEnum item) {
- return new PropertyAspectAdapterXXXX<OxmXmlEnum, String>(OxmTypeMapping.TYPE_NAME_PROPERTY, item) {
- @Override
- protected String buildValue_() {
- return this.subject.getTypeName().getTypeQualifiedName();
- }
- };
- }
-
- protected PropertyValueModel<String> buildOxmXmlEnumDescriptionModel(OxmXmlEnum item) {
- return new PropertyAspectAdapterXXXX<OxmXmlEnum, String>(OxmTypeMapping.TYPE_NAME_PROPERTY, item) {
- @Override
- protected String buildValue_() {
- return this.subject.getTypeName().getFullyQualifiedName();
- }
- };
- }
-
// ********** oxm java attribute **********
@@ -176,25 +164,37 @@ public class ELJaxbNavigatorItemLabelProviderFactory
}
protected PropertyValueModel<ImageDescriptor> buildOxmJavaAttributeImageDescriptorModel(OxmJavaAttribute item) {
- return new PropertyAspectAdapterXXXX<OxmJavaAttribute, ImageDescriptor>(JaxbPersistentAttribute.MAPPING_PROPERTY, item) {
- @Override
- protected ImageDescriptor buildValue_() {
- return ELJaxbNavigatorItemLabelProviderFactory.this.buildOxmJavaAttributeImageDescriptor(this.subject.getMappingKey());
- }
- };
+ return PropertyValueModelTools.transform(this.buildOxmJavaAttributeMappingKeyModel(item), MAPPING_KEY_IMAGE_DESCRIPTOR_TRANSFORMER);
}
- protected ImageDescriptor buildOxmJavaAttributeImageDescriptor(String mappingKey) {
- return ELJaxbMappingImageHelper.imageDescriptorForAttributeMapping(mappingKey);
+ protected PropertyValueModel<String> buildOxmJavaAttributeMappingKeyModel(OxmJavaAttribute item) {
+ return PropertyValueModelTools.transform(this.buildOxmJavaAttributeMappingModel(item), JaxbAttributeMapping.KEY_TRANSFORMER);
+ }
+
+ protected PropertyValueModel<JaxbAttributeMapping> buildOxmJavaAttributeMappingModel(OxmJavaAttribute item) {
+ return PropertyValueModelTools.modelAspectAdapter(
+ item,
+ JaxbPersistentAttribute.MAPPING_PROPERTY,
+ JaxbPersistentAttribute.MAPPING_TRANSFORMER
+ );
+ }
+
+ protected static final Transformer<String, ImageDescriptor> MAPPING_KEY_IMAGE_DESCRIPTOR_TRANSFORMER = new MappingKeyImageDescriptorTransformer();
+ protected static final class MappingKeyImageDescriptorTransformer
+ extends TransformerAdapter<String, ImageDescriptor>
+ {
+ @Override
+ public ImageDescriptor transform(String mappingKey) {
+ return ELJaxbMappingImageHelper.imageDescriptorForAttributeMapping(mappingKey);
+ }
}
protected PropertyValueModel<String> buildOxmJavaAttributeTextModel(OxmJavaAttribute item) {
- return new PropertyAspectAdapterXXXX<OxmJavaAttribute, String>(OxmJavaAttribute.JAVA_ATTRIBUTE_NAME_PROPERTY, item) {
- @Override
- protected String buildValue_() {
- return this.subject.getJavaAttributeName();
- }
- };
+ return PropertyValueModelTools.modelAspectAdapter(
+ item,
+ OxmJavaAttribute.JAVA_ATTRIBUTE_NAME_PROPERTY,
+ OxmJavaAttribute.JAVA_ATTRIBUTE_NAME_TRANSFORMER
+ );
}
protected PropertyValueModel<String> buildOxmJavaAttributeDescriptionModel(OxmJavaAttribute item) {

Back to the top