com.jwebmp.guicedinjection.properties.GlobalProperties Maven / Gradle / Ivy
Show all versions of guiced-injection Show documentation
/*
* Copyright (C) 2017 GedMarc
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.jwebmp.guicedinjection.properties;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jwebmp.guicedinjection.GuiceContext;
import com.jwebmp.logger.LogFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.*;
import static com.fasterxml.jackson.annotation.JsonInclude.Include.*;
/**
* A pretty class for containing EAR or Container level global properties.
*
* Key to Map ID to Property
*
* @author GedMarc
* @since 08 Jul 2017
*/
@SuppressWarnings("MissingClassJavaDoc")
@javax.inject.Singleton
@JsonAutoDetect(fieldVisibility = ANY,
getterVisibility = NONE,
setterVisibility = NONE)
@JsonInclude(NON_NULL)
public class GlobalProperties
{
private static final Logger log = LogFactory.getLog("GlobalPropertyMaps");
private final Map> globalProperties;
/**
* Constructs a new GlobalProperties
*/
public GlobalProperties()
{
globalProperties = new HashMap<>();
}
/**
* Adds a key to the global application library
*
* @param key
* Adds a key into the global library
* @param properties
* Puts the property map into the global settings
*/
public void addKey(String key, Map