/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.rendering.internal.parser.xhtml.wikimodel;

import org.xwiki.rendering.listener.reference.ResourceReference;
import org.xwiki.rendering.wikimodel.WikiParameters;
import org.xwiki.rendering.wikimodel.WikiReference;

/**
 * WikiModel extension in order to add additional XWiki Link information so that the XWiki Generator Listener for the
 * XHTML syntax doesn't have to do any link parsing.
 *
 * @version $Id$
 * @since 2.5RC1
 */
public class XWikiWikiReference extends WikiReference
{
    private ResourceReference reference;

    private boolean isFreeStanding;

    public XWikiWikiReference(ResourceReference reference, String label, WikiParameters linkParameters,
        boolean isFreeStanding)
    {
        super(reference.getReference(), label, linkParameters);
        this.reference = reference;
        this.isFreeStanding = isFreeStanding;
    }

    public boolean isFreeStanding()
    {
        return this.isFreeStanding;
    }

    public ResourceReference getReference()
    {
        return this.reference;
    }

    // TODO: Ensure there's no sync issue between reference object and getLink() from WikiReference
    // TODO: implement hashcode, equals, totring
}

@@ -949,16 +949,128 @@
 model;%0A%0A
+import org.apache.commons.lang3.builder.EqualsBuilder;%0Aimport org.apache.commons.lang3.builder.HashCodeBuilder;%0A
 import o
@@ -1126,16 +1126,16 @@
 erence;%0A
-
 import o
@@ -1558,35 +1558,33 @@
 private boolean 
-isF
+f
 reeStanding;%0A%0A  
@@ -1693,35 +1693,33 @@
         boolean 
-isF
+f
 reeStanding)%0A   
@@ -1830,27 +1830,25 @@
        this.
-isF
+f
 reeStanding 
@@ -1849,19 +1849,17 @@
 nding = 
-isF
+f
 reeStand
@@ -1932,19 +1932,17 @@
 rn this.
-isF
+f
 reeStand
@@ -2168,32 +2168,559 @@
 ent 
-hashcode, equals, totring
+totring%0A%0A    @Override%0A    public boolean equals(Object obj)%0A    %7B%0A        EqualsBuilder builder = new EqualsBuilder();%0A%0A        builder.appendSuper(super.equals(obj));%0A        builder.append(reference);%0A        builder.append(freeStanding);%0A%0A        return builder.isEquals();%0A    %7D%0A%0A    @Override%0A    public int hashCode()%0A    %7B%0A        HashCodeBuilder builder = new HashCodeBuilder();%0A%0A        builder.appendSuper(super.hashCode());%0A        builder.append(reference);%0A        builder.append(freeStanding);%0A%0A        return builder.toHashCode();%0A    %7D
 %0A%7D%0A

Improve codestyle and fix a TODO