- private static Callable<? extends SchemaUnawareCodec> getCodecLoader(final Class<?> typeClz,
- final TypeDefinition<?> def) {
-
- TypeDefinition<?> rootType = def;
- while (rootType.getBaseType() != null) {
- rootType = rootType.getBaseType();
- }
- if (rootType instanceof EnumTypeDefinition) {
- return EnumerationCodec.loader(typeClz, (EnumTypeDefinition) rootType);
- } else if (rootType instanceof BitsTypeDefinition) {
- return BitsCodec.loader(typeClz, (BitsTypeDefinition) rootType);
- }
- return EncapsulatedValueCodec.loader(typeClz, def);
- }
-