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

com.enonic.xp.session.SessionKey Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.session;

import java.util.Objects;
import java.util.UUID;

import com.enonic.xp.annotation.PublicApi;

@PublicApi
public final class SessionKey
{
    private final String value;

    private SessionKey( final String value )
    {
        this.value = Objects.requireNonNull( value );
    }

    @Override
    public int hashCode()
    {
        return this.value.hashCode();
    }

    @Override
    public boolean equals( final Object obj )
    {
        return ( obj instanceof SessionKey ) && ( (SessionKey) obj ).value.equals( this.value );
    }

    @Override
    public String toString()
    {
        return this.value;
    }

    public static SessionKey from( final String value )
    {
        return new SessionKey( value );
    }

    @Deprecated
    public static SessionKey generate()
    {
        return new SessionKey( UUID.randomUUID().toString() );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy