/** * @param cls type to examine. * @return true if typeId equals for passed type and current * binary enum. */ public boolean isTypeEquals(final Class<?> cls) { return ctx.descriptorForClass(cls, false, false).typeId() == typeId(); } }
/** * @param val Value. */ void doWriteBinaryEnum(BinaryEnumObjectImpl val) { assert val != null; int typeId = val.typeId(); if (typeId != GridBinaryMarshaller.UNREGISTERED_TYPE_ID) { out.unsafeEnsure(1 + 4 + 4); out.unsafeWriteByte(GridBinaryMarshaller.BINARY_ENUM); out.unsafeWriteInt(typeId); out.unsafeWriteInt(val.enumOrdinal()); } else { out.unsafeEnsure(1 + 4); out.unsafeWriteByte(GridBinaryMarshaller.BINARY_ENUM); out.unsafeWriteInt(typeId); doWriteString(val.className()); out.writeInt(val.enumOrdinal()); } }
/** * @param binCtx Binary context. * @param ord Enum ordinal. * @param typeId Type Id. * @param clsName Class name. */ private void checkInstanceFromBytes(BinaryContext binCtx, int ord, int typeId, String clsName) throws IgniteCheckedException { BinaryEnumObjectImpl srcBinEnum =new BinaryEnumObjectImpl(binCtx, typeId, clsName, ord); Marshaller marsh = node1.configuration().getMarshaller(); byte[] bytes = marsh.marshal(srcBinEnum); BinaryEnumObjectImpl binEnum = new BinaryEnumObjectImpl(binCtx, bytes); assertEquals(clsName, binEnum.className()); assertEquals(typeId, binEnum.typeId()); assertEquals(ord, binEnum.enumOrdinal()); }
/** * @param cls type to examine. * @return true if typeId equals for passed type and current * binary enum. */ public boolean isTypeEquals(final Class<?> cls) { return ctx.descriptorForClass(cls, false, false).typeId() == typeId(); } }
/** * @param val Value. */ void doWriteBinaryEnum(BinaryEnumObjectImpl val) { assert val != null; int typeId = val.typeId(); if (typeId != GridBinaryMarshaller.UNREGISTERED_TYPE_ID) { out.unsafeEnsure(1 + 4 + 4); out.unsafeWriteByte(GridBinaryMarshaller.BINARY_ENUM); out.unsafeWriteInt(typeId); out.unsafeWriteInt(val.enumOrdinal()); } else { out.unsafeEnsure(1 + 4); out.unsafeWriteByte(GridBinaryMarshaller.BINARY_ENUM); out.unsafeWriteInt(typeId); doWriteString(val.className()); out.writeInt(val.enumOrdinal()); } }