diff options
author | bvosburgh | 2012-02-27 17:37:35 +0000 |
---|---|---|
committer | bvosburgh | 2012-02-27 17:37:35 +0000 |
commit | c25f35348cc0475a59a4c3b0fa2b8ef61104bafb (patch) | |
tree | 9c115f8ef3f8441b336c988c1cb9efd8082aec2f /jaxb | |
parent | a662ed528fcaf32d7320bc333f9ac484a68cb2ca (diff) | |
download | webtools.dali-c25f35348cc0475a59a4c3b0fa2b8ef61104bafb.tar.gz webtools.dali-c25f35348cc0475a59a4c3b0fa2b8ef61104bafb.tar.xz webtools.dali-c25f35348cc0475a59a4c3b0fa2b8ef61104bafb.zip |
remove Tools.valueIsEqualToOneOf(...)
Diffstat (limited to 'jaxb')
-rw-r--r-- | jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java index 0e084994c2..48bf63d813 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. + * Copyright (c) 2011, 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 @@ -13,9 +13,9 @@ import java.util.List; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.common.utility.Filter; +import org.eclipse.jpt.common.utility.internal.ArrayTools; import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; import org.eclipse.jpt.jaxb.core.MappingKeys; @@ -168,7 +168,6 @@ public class ELJavaXmlInverseReferenceMapping } protected void validateMappedBy(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) { - String mappedBy = getMappedBy(); if (StringTools.stringIsEmpty(mappedBy)) { messages.add( ELJaxbValidationMessageBuilder.buildMessage( @@ -196,12 +195,9 @@ public class ELJavaXmlInverseReferenceMapping getMappedByTextRange(astRoot))); } else if ( - ! Tools.valueIsEqualToOneOf( - referencedAttribute.getMappingKey(), - MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY, - MappingKeys.XML_ELEMENTS_ATTRIBUTE_MAPPING_KEY, - MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY, - MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY)) { + ! ArrayTools.contains( + getValidReferencedAttributeMappingKeys(), + referencedAttribute.getMappingKey())) { messages.add( ELJaxbValidationMessageBuilder.buildMessage( IMessage.HIGH_SEVERITY, @@ -211,6 +207,17 @@ public class ELJavaXmlInverseReferenceMapping getMappedByTextRange(astRoot))); } } + + protected String[] getValidReferencedAttributeMappingKeys() { + return VALID_REFERENCED_ATTRIBUTE_MAPPING_KEYS; + } + + protected static final String[] VALID_REFERENCED_ATTRIBUTE_MAPPING_KEYS = new String[] { + MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY, + MappingKeys.XML_ELEMENTS_ATTRIBUTE_MAPPING_KEY, + MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY, + MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY + }; protected TextRange getMappedByTextRange(CompilationUnit astRoot) { TextRange textRange = getXmlInverseReferenceAnnotation().getMappedByTextRange(astRoot); |