/** * @param clsName Class name. * @return Type name. */ public String userTypeName(String clsName) { BinaryInternalMapper mapper = userTypeMapper(clsName); return mapper.typeName(clsName); }
/** * @param typeId Type ID. * @param fieldName Field name. * @return Field ID. */ public int fieldId(int typeId, String fieldName) { BinaryInternalMapper mapper = userTypeMapper(typeId); return mapper.fieldId(typeId, fieldName); }
/** * @param typeName Type name. * @return Type ID. */ public int typeId(String typeName) { Integer id = predefinedTypeNames.get(SIMPLE_NAME_LOWER_CASE_MAPPER.typeName(typeName)); if (id != null) return id; if (marshCtx.isSystemType(typeName)) return typeName.hashCode(); BinaryInternalMapper mapper = userTypeMapper(typeName); return mapper.typeId(typeName); }
/** * Create binary field. * * @param typeId Type ID. * @param fieldName Field name. * @return Binary field. */ public BinaryFieldImpl createField(int typeId, String fieldName) { BinarySchemaRegistry schemaReg = schemaRegistry(typeId); BinaryInternalMapper mapper = userTypeMapper(typeId); int fieldId = mapper.fieldId(typeId, fieldName); return new BinaryFieldImpl(this, typeId, schemaReg, fieldName, fieldId); }
/** * @param fieldName Field name. * @throws org.apache.ignite.binary.BinaryObjectException If fields are not allowed. */ private void writeFieldId(String fieldName) throws BinaryObjectException { A.notNull(fieldName, "fieldName"); if (rawOffPos != 0) throw new BinaryObjectException("Individual field can't be written after raw writer is acquired."); if (mapper == null) mapper = ctx.userTypeMapper(typeId); assert mapper != null; int id = mapper.fieldId(typeId, fieldName); writeFieldId(id); }
/** * Register "type ID to class name" mapping on all nodes to allow for mapping requests resolution form client. * Other {@link BinaryContext}'s "register" methods and method * {@link BinaryContext#descriptorForClass(Class, boolean, boolean)} already call this functionality * so use this method only when registering class names whose {@link Class} is unknown. * * @param typeId Type ID. * @param clsName Class Name. * @return {@code True} if the mapping was registered successfully. */ public boolean registerUserClassName(int typeId, String clsName) { IgniteCheckedException e = null; boolean res = false; try { res = marshCtx.registerClassName(JAVA_ID, typeId, clsName); } catch (DuplicateTypeIdException dupEx) { // Ignore if trying to register mapped type name of the already registered class name and vise versa BinaryInternalMapper mapper = userTypeMapper(typeId); String oldName = dupEx.getRegisteredClassName(); if (!(mapper.typeName(oldName).equals(clsName) || mapper.typeName(clsName).equals(oldName))) e = dupEx; } catch (IgniteCheckedException igniteEx) { e = igniteEx; } if (e != null) throw new BinaryObjectException("Failed to register class.", e); return res; }
BinaryInternalMapper mapper = userTypeMapper(clsName);
mapper = userType ? ctx.userTypeMapper(typeId) : BinaryContext.defaultMapper(); schema = BinaryUtils.hasSchema(flags) ? getOrCreateSchema() : null;
/** * @param clsName Class name. * @return Type name. */ public String userTypeName(String clsName) { BinaryInternalMapper mapper = userTypeMapper(clsName); return mapper.typeName(clsName); }
/** * @param typeId Type ID. * @param fieldName Field name. * @return Field ID. */ public int fieldId(int typeId, String fieldName) { BinaryInternalMapper mapper = userTypeMapper(typeId); return mapper.fieldId(typeId, fieldName); }
/** * @param typeName Type name. * @return Type ID. */ public int typeId(String typeName) { Integer id = predefinedTypeNames.get(SIMPLE_NAME_LOWER_CASE_MAPPER.typeName(typeName)); if (id != null) return id; if (marshCtx.isSystemType(typeName)) return typeName.hashCode(); BinaryInternalMapper mapper = userTypeMapper(typeName); return mapper.typeId(typeName); }
/** * Create binary field. * * @param typeId Type ID. * @param fieldName Field name. * @return Binary field. */ public BinaryFieldImpl createField(int typeId, String fieldName) { BinarySchemaRegistry schemaReg = schemaRegistry(typeId); BinaryInternalMapper mapper = userTypeMapper(typeId); int fieldId = mapper.fieldId(typeId, fieldName); return new BinaryFieldImpl(this, typeId, schemaReg, fieldName, fieldId); }
/** * @param fieldName Field name. * @throws org.apache.ignite.binary.BinaryObjectException If fields are not allowed. */ private void writeFieldId(String fieldName) throws BinaryObjectException { A.notNull(fieldName, "fieldName"); if (rawOffPos != 0) throw new BinaryObjectException("Individual field can't be written after raw writer is acquired."); if (mapper == null) mapper = ctx.userTypeMapper(typeId); assert mapper != null; int id = mapper.fieldId(typeId, fieldName); writeFieldId(id); }
/** * Register "type ID to class name" mapping on all nodes to allow for mapping requests resolution form client. * Other {@link BinaryContext}'s "register" methods and method * {@link BinaryContext#descriptorForClass(Class, boolean, boolean)} already call this functionality * so use this method only when registering class names whose {@link Class} is unknown. * * @param typeId Type ID. * @param clsName Class Name. * @return {@code True} if the mapping was registered successfully. */ public boolean registerUserClassName(int typeId, String clsName) { IgniteCheckedException e = null; boolean res = false; try { res = marshCtx.registerClassName(JAVA_ID, typeId, clsName); } catch (DuplicateTypeIdException dupEx) { // Ignore if trying to register mapped type name of the already registered class name and vise versa BinaryInternalMapper mapper = userTypeMapper(typeId); String oldName = dupEx.getRegisteredClassName(); if (!(mapper.typeName(oldName).equals(clsName) || mapper.typeName(clsName).equals(oldName))) e = dupEx; } catch (IgniteCheckedException igniteEx) { e = igniteEx; } if (e != null) throw new BinaryObjectException("Failed to register class.", e); return res; }
BinaryInternalMapper mapper = userTypeMapper(clsName);
mapper = userType ? ctx.userTypeMapper(typeId) : BinaryContext.defaultMapper(); schema = BinaryUtils.hasSchema(flags) ? getOrCreateSchema() : null;