All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.randombits.confluence.metadata.impl.handler.WikiReferenceHandler Maven / Gradle / Ivy

There is a newer version: 7.4.1
Show newest version
package org.randombits.confluence.metadata.impl.handler;

import org.randombits.confluence.metadata.HasAlias;
import org.randombits.confluence.metadata.TypeHandler;
import org.randombits.confluence.metadata.reference.WikiReference;
import org.randombits.storage.Aliasable;

/**
 * Handles {@link org.randombits.confluence.metadata.reference.WikiReference} instances.
 */
@SuppressWarnings({"deprecation"})
public class WikiReferenceHandler implements TypeHandler, HasAlias {

    public static final String LEGACY_ALIAS = "ListOption";

    public static final String ALIAS = "WikiReference";

    public boolean supportsOriginal( Object original ) {
        // This is a one-way handler, for backwards-compatibility.
        return false;
    }

    public boolean supportsStorable( Object stored ) {
        return stored instanceof WikiReference;
    }

    public String getOriginal( Object reference ) {
        WikiReference wikiReference = (WikiReference) reference;
        return wikiReference.getNonWiki();
        //return wikiReference.getWiki() == null ? wikiReference.getNonWiki() : wikiReference.getWiki();
    }

    public Object getStorable( Object value ) {
        // No creation of WikiReference supported.
        return null;
    }

    public void applyAliases( Aliasable aliasable ) {
        aliasable.addAlias( ALIAS, WikiReference.class );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy