예제 #1
0
        /// <summary>
        /// Casts to <see cref="BinaryObject"/> or throws an error.
        /// </summary>
        private static BinaryObject GetBinaryObject(IBinaryObject obj)
        {
            var binObj = obj as BinaryObject;

            if (binObj != null)
                return binObj;

            throw new NotSupportedException(string.Format("{0} of type {1} is not supported.",
                typeof(IBinaryObject), obj.GetType()));
        }
예제 #2
0
        /** <inheritDoc /> */
        public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
        {
            IgniteArgumentCheck.NotNull(obj, "obj");

            BinaryObject obj0 = obj as BinaryObject;

            if (obj0 == null)
                throw new ArgumentException("Unsupported object type: " + obj.GetType());

            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);
            
            return Builder0(null, obj0, desc);
        }
예제 #3
0
파일: Binary.cs 프로젝트: mshonichev/ignite
        /** <inheritDoc /> */
        public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
        {
            IgniteArgumentCheck.NotNull(obj, "obj");

            BinaryObject obj0 = obj as BinaryObject;

            if (obj0 == null)
            {
                throw new ArgumentException("Unsupported object type: " + obj.GetType());
            }

            if (obj0 is BinaryEnum)
            {
                throw new InvalidOperationException("Builder cannot be created for enum.");
            }

            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);

            return(Builder0(null, obj0, desc));
        }