001 /**
002 * GRANITE DATA SERVICES
003 * Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S.
004 *
005 * This file is part of the Granite Data Services Platform.
006 *
007 * Granite Data Services is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * Granite Data Services is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
015 * General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
020 * USA, or see <http://www.gnu.org/licenses/>.
021 */
022 package org.granite.messaging.jmf;
023
024 import java.io.IOException;
025 import java.lang.reflect.InvocationTargetException;
026
027 import org.granite.messaging.jmf.codec.ExtendedObjectCodec;
028 import org.granite.messaging.jmf.codec.StandardCodec;
029 import org.granite.messaging.jmf.codec.std.BooleanCodec;
030 import org.granite.messaging.jmf.codec.std.ByteCodec;
031 import org.granite.messaging.jmf.codec.std.CharacterCodec;
032 import org.granite.messaging.jmf.codec.std.DoubleCodec;
033 import org.granite.messaging.jmf.codec.std.FloatCodec;
034 import org.granite.messaging.jmf.codec.std.IntegerCodec;
035 import org.granite.messaging.jmf.codec.std.LongCodec;
036 import org.granite.messaging.jmf.codec.std.NullCodec;
037 import org.granite.messaging.jmf.codec.std.ShortCodec;
038 import org.granite.messaging.jmf.codec.std.StringCodec;
039 import org.granite.messaging.reflect.Property;
040
041 /**
042 * @author Franck WOLFF
043 */
044 public interface CodecRegistry extends JMFConstants {
045
046 NullCodec getNullCodec();
047
048 BooleanCodec getBooleanCodec();
049 CharacterCodec getCharacterCodec();
050 ByteCodec getByteCodec();
051 ShortCodec getShortCodec();
052 IntegerCodec getIntegerCodec();
053 LongCodec getLongCodec();
054 FloatCodec getFloatCodec();
055 DoubleCodec getDoubleCodec();
056 StringCodec getStringCodec();
057
058 <T> StandardCodec<T> getCodec(int jmfType);
059 <T> StandardCodec<T> getCodec(Object v);
060
061 ExtendedObjectCodec findExtendedEncoder(ExtendedObjectOutput out, Object v);
062 ExtendedObjectCodec findExtendedDecoder(ExtendedObjectInput in, String className);
063
064 static interface PrimitivePropertyCodec {
065 public void encodePrimitive(OutputContext ctx, Object holder, Property property)
066 throws IllegalAccessException, IOException, InvocationTargetException;
067 public void decodePrimitive(InputContext ctx, Object holder, Property property)
068 throws IllegalAccessException, IOException, InvocationTargetException;
069 }
070
071 PrimitivePropertyCodec getPrimitivePropertyCodec(Class<?> propertyCls);
072
073 int extractJmfType(int parameterizedJmfType);
074
075 int jmfTypeOfPrimitiveClass(Class<?> cls);
076 Class<?> primitiveClassOfJmfType(int jmfType);
077 }