static Class<?> resolveClass(String className) { final RuntimeFieldFactory<Object> inline = RuntimeFieldFactory .getInline(className); if (inline == null) return RuntimeEnv.loadClass(className); if (className.indexOf('.') != -1) return inline.typeClass(); switch (inline.id) { case ID_BOOL: return boolean.class; case ID_BYTE: return byte.class; case ID_CHAR: return char.class; case ID_SHORT: return short.class; case ID_INT32: return int.class; case ID_INT64: return long.class; case ID_FLOAT: return float.class; case ID_DOUBLE: return double.class; default: throw new RuntimeException("Should never happen."); } }
static Class<?> resolveClass(String className) { final RuntimeFieldFactory<Object> inline = RuntimeFieldFactory .getInline(className); if (inline == null) return RuntimeEnv.loadClass(className); if (className.indexOf('.') != -1) return inline.typeClass(); switch (inline.id) { case ID_BOOL: return boolean.class; case ID_BYTE: return byte.class; case ID_CHAR: return char.class; case ID_SHORT: return short.class; case ID_INT32: return int.class; case ID_INT64: return long.class; case ID_FLOAT: return float.class; case ID_DOUBLE: return double.class; default: throw new RuntimeException("Should never happen."); } }
@SuppressWarnings("unchecked") static void writeObjectTo(Output output, Object value, Schema<?> currentSchema, IdStrategy strategy) throws IOException { final Class<Object> clazz = (Class<Object>) value.getClass(); final RuntimeFieldFactory<Object> inline = RuntimeFieldFactory .getInline(clazz); if (inline != null) { // scalar value inline.writeTo(output, inline.id, value, false); return; } // AtomicInteger/AtomicLong final Schema<Object> schema = strategy.writePojoIdTo(output, ID_POJO, clazz).getSchema(); if (output instanceof StatefulOutput) { // update using the derived schema. ((StatefulOutput) output).updateLast(schema, currentSchema); } schema.writeTo(output, value); }
@SuppressWarnings("unchecked") static void writeObjectTo(Output output, Object value, Schema<?> currentSchema, IdStrategy strategy) throws IOException { final Class<Object> clazz = (Class<Object>) value.getClass(); final RuntimeFieldFactory<Object> inline = RuntimeFieldFactory .getInline(clazz); if (inline != null) { // scalar value inline.writeTo(output, inline.id, value, false); return; } // AtomicInteger/AtomicLong final Schema<Object> schema = strategy.writePojoIdTo(output, ID_POJO, clazz).getSchema(); if (output instanceof StatefulOutput) { // update using the derived schema. ((StatefulOutput) output).updateLast(schema, currentSchema); } schema.writeTo(output, value); }
RuntimeFieldFactory.getInline(componentType);
RuntimeFieldFactory.getInline(componentType);
static Class<?> resolveClass(String className) { final RuntimeFieldFactory<Object> inline = RuntimeFieldFactory.getInline(className); if (inline == null) return RuntimeEnv.loadClass(className); if (className.indexOf('.') != -1) return inline.typeClass(); switch (inline.id) { case ID_BOOL: return boolean.class; case ID_BYTE: return byte.class; case ID_CHAR: return char.class; case ID_SHORT: return short.class; case ID_INT32: return int.class; case ID_INT64: return long.class; case ID_FLOAT: return float.class; case ID_DOUBLE: return double.class; default: throw new RuntimeException("Should never happen."); } }
RuntimeFieldFactory.getInline(componentType);
RuntimeFieldFactory.getInline(componentType);