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

io.naraway.janitor.context.JanitorContext Maven / Gradle / Ivy

Go to download

Basic and shared domain model components used when developing drama on Nara Way.

The newest version!
/*
 * COPYRIGHT (c) NEXTREE Inc. 2014
 * This software is the proprietary of NEXTREE Inc.
 * @since 2014. 6. 10.
 */

package io.naraway.janitor.context;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class JanitorContext {
    //
    private static final ThreadLocal context = new ThreadLocal<>();

    public static JanitorStreamEvent get() {
        //
        if (!exists()) {
            setDefault();
        }

        return context.get();
    }

    public static void set(JanitorStreamEvent event) {
        //
        context.set(event);
    }

    public static void clear() {
        //
        context.remove();
    }

    public static void setDefault() {
        //
        context.set(JanitorStreamEvent.newInstance());
    }

    private static boolean exists() {
        //
        return context.get() != null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy