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

pl.bristleback.server.bristle.serialization.SerializationBundle Maven / Gradle / Ivy

/*
 * Bristleback Websocket Framework - Copyright (c) 2010-2013 http://bristleback.pl
 * ---------------------------------------------------------------------------
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 3 of the License, or (at your
 * option) any later version.
 * This library 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.
 * You should have received a copy of the GNU Lesser General Public License along
 * with this program; if not, see .
 * ---------------------------------------------------------------------------
 */

package pl.bristleback.server.bristle.serialization;

import java.util.HashMap;
import java.util.Map;

/**
 * //@todo class description
 * 

* Created on: 2011-10-08 14:46:06
* * @author Wojciech Niemiec */ public class SerializationBundle { private Map serializations = new HashMap(); public Object getSerialization(Class payloadType) { return serializations.get(payloadType); } public void addSerialization(Class payloadType, Object serialization) { if (isSerializationForPayloadTypeExist(payloadType)) { throw new SerializationResolvingException("Default serialization for type " + payloadType + " already exists"); } serializations.put(payloadType, serialization); } public boolean isSerializationForPayloadTypeExist(Class payloadType) { return serializations.containsKey(payloadType); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy