Author: veithen Date: Mon Sep 21 22:15:02 2015 New Revision: 1704436 URL: http://svn.apache.org/viewvc?rev=1704436&view=rev Log: Eliminate duplicate code.
Added: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupport.java (with props) webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupportMixin.aj (with props) Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCategories.java webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCollection.java webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaLink.java webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMLink.java Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCategories.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCategories.java?rev=1704436&r1=1704435&r2=1704436&view=diff ============================================================================== --- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCategories.java (original) +++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCategories.java Mon Sep 21 22:15:02 2015 @@ -20,6 +20,6 @@ package org.apache.axiom.fom; import org.apache.abdera.model.Categories; -public interface AbderaCategories extends Categories, AbderaExtensibleElement { +public interface AbderaCategories extends Categories, AbderaExtensibleElement, HrefAttributeSupport { } Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCollection.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCollection.java?rev=1704436&r1=1704435&r2=1704436&view=diff ============================================================================== --- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCollection.java (original) +++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaCollection.java Mon Sep 21 22:15:02 2015 @@ -20,6 +20,6 @@ package org.apache.axiom.fom; import org.apache.abdera.model.Collection; -public interface AbderaCollection extends Collection, AbderaExtensibleElement { +public interface AbderaCollection extends Collection, AbderaExtensibleElement, HrefAttributeSupport { } Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaLink.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaLink.java?rev=1704436&r1=1704435&r2=1704436&view=diff ============================================================================== --- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaLink.java (original) +++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaLink.java Mon Sep 21 22:15:02 2015 @@ -20,6 +20,6 @@ package org.apache.axiom.fom; import org.apache.abdera.model.Link; -public interface AbderaLink extends Link, AbderaExtensibleElement { +public interface AbderaLink extends Link, AbderaExtensibleElement, HrefAttributeSupport { } Added: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupport.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupport.java?rev=1704436&view=auto ============================================================================== --- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupport.java (added) +++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupport.java Mon Sep 21 22:15:02 2015 @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axiom.fom; + +public interface HrefAttributeSupport extends AbderaElement { + +} Propchange: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupport.java ------------------------------------------------------------------------------ svn:eol-style = native Added: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupportMixin.aj URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupportMixin.aj?rev=1704436&view=auto ============================================================================== --- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupportMixin.aj (added) +++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupportMixin.aj Mon Sep 21 22:15:02 2015 @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axiom.fom; + +import static org.apache.abdera.util.Constants.HREF; + +import org.apache.abdera.i18n.iri.IRI; + +public aspect HrefAttributeSupportMixin { + public final IRI HrefAttributeSupport.getHref() { + return IRIUtil.getUriValue(getAttributeValue(HREF)); + } + + public final IRI HrefAttributeSupport.getResolvedHref() { + return IRIUtil.resolve(getResolvedBaseUri(), getHref()); + } + + public final void HrefAttributeSupport.internalSetHref(String href) { + if (href != null) { + setAttributeValue(HREF, (new IRI(href)).toString()); + } else { + removeAttribute(HREF); + } + } +} Propchange: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/HrefAttributeSupportMixin.aj ------------------------------------------------------------------------------ svn:eol-style = native Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java?rev=1704436&r1=1704435&r2=1704436&view=diff ============================================================================== --- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java (original) +++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java Mon Sep 21 22:15:02 2015 @@ -25,7 +25,6 @@ import org.apache.abdera.model.Categorie import org.apache.abdera.model.Category; import org.apache.abdera.parser.stax.util.FOMHelper; import org.apache.axiom.fom.AbderaCategories; -import org.apache.axiom.fom.IRIUtil; import org.apache.axiom.om.OMElement; public class FOMCategories extends FOMExtensibleElement implements AbderaCategories { @@ -103,19 +102,8 @@ public class FOMCategories extends FOMEx return this; } - public IRI getHref() { - return IRIUtil.getUriValue(getAttributeValue(HREF)); - } - - public IRI getResolvedHref() { - return IRIUtil.resolve(getResolvedBaseUri(), getHref()); - } - public Categories setHref(String href) { - if (href != null) - setAttributeValue(HREF, (new IRI(href)).toString()); - else - removeAttribute(HREF); + internalSetHref(href); return this; } Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java?rev=1704436&r1=1704435&r2=1704436&view=diff ============================================================================== --- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java (original) +++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java Mon Sep 21 22:15:02 2015 @@ -23,7 +23,6 @@ import java.util.List; import javax.activation.MimeType; -import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.model.Categories; import org.apache.abdera.model.Category; import org.apache.abdera.model.Collection; @@ -31,7 +30,6 @@ import org.apache.abdera.model.Element; import org.apache.abdera.model.Text; import org.apache.abdera.util.MimeTypeHelper; import org.apache.axiom.fom.AbderaCollection; -import org.apache.axiom.fom.IRIUtil; import org.apache.axiom.om.OMElement; @SuppressWarnings("deprecation") @@ -68,19 +66,8 @@ public class FOMCollection extends FOMEx return getFirstChild(TITLE); } - public IRI getHref() { - return IRIUtil.getUriValue(getAttributeValue(HREF)); - } - - public IRI getResolvedHref() { - return IRIUtil.resolve(getResolvedBaseUri(), getHref()); - } - public Collection setHref(String href) { - if (href != null) - setAttributeValue(HREF, (new IRI(href).toString())); - else - removeAttribute(HREF); + internalSetHref(href); return this; } Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMLink.java URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMLink.java?rev=1704436&r1=1704435&r2=1704436&view=diff ============================================================================== --- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMLink.java (original) +++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMLink.java Mon Sep 21 22:15:02 2015 @@ -19,26 +19,13 @@ package org.apache.abdera.parser.stax; import javax.activation.MimeType; -import org.apache.abdera.i18n.iri.IRI; import org.apache.abdera.model.Element; import org.apache.abdera.model.Link; import org.apache.axiom.fom.AbderaLink; -import org.apache.axiom.fom.IRIUtil; public class FOMLink extends FOMExtensibleElement implements AbderaLink { - public IRI getHref() { - return IRIUtil.getUriValue(getAttributeValue(HREF)); - } - - public IRI getResolvedHref() { - return IRIUtil.resolve(getResolvedBaseUri(), getHref()); - } - public Link setHref(String href) { - if (href != null) - setAttributeValue(HREF, (new IRI(href)).toString()); - else - removeAttribute(HREF); + internalSetHref(href); return this; }