org.opendaylight.protocol.concepts.HandlerRegistry Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.protocol.concepts;
import org.opendaylight.yangtools.concepts.Registration;
public class HandlerRegistry {
private final MultiRegistry, S> serializers = new MultiRegistry<>();
private final MultiRegistry parsers = new MultiRegistry<>();
public Registration registerParser(final int type, final P parser) {
return parsers.register(type, parser);
}
public P getParser(final int type) {
return parsers.get(type);
}
public Registration registerSerializer(final Class clazz, final S serializer) {
return serializers.register(clazz, serializer);
}
public S getSerializer(final Class clazz) {
return serializers.get(clazz);
}
public Iterable getAllSerializers() {
return serializers.getAllValues();
}
}