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

org.randombits.confluence.intercom.tracker.LocalTrackerConnection Maven / Gradle / Ivy

Go to download

This is a support library for Confluence plugins, providing some commonly-used classes and libraries.

The newest version!
package org.randombits.confluence.intercom.tracker;

/**
 * Provides an object of a particular type.
 * 
 * @author David Peterson
 */
public class LocalTrackerConnection implements TrackerConnection {

    private final Object value;

    /**
     * Constructs the provider with the specified value.
     * 
     * @param value
     *            The value to provide.
     */
    public LocalTrackerConnection( Object value ) {
        this.value = value;
    }

    /**
     * Returns the value as an instance of the specified type, if the current
     * value supports it. If the type is null or
     * the value does not support it, null is returned.
     */
    public  T getValue( Class type ) {
        if ( type != null && type.isInstance( value ) )
            return type.cast( value );
        return null;
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + "[ " + value + " ]";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy