private static Object castValue()

in src/main/java/com/epam/eco/commons/avro/converter/AvroCaster.java [68:89]


    private static Object castValue(
            Object value,
            Schema valueSchema,
            Schema valueCastSchema,
            Set<Feature> features) {
        if (value == null || valueSchema.getType() != valueCastSchema.getType()) {
            return null;
        }
        if (Type.ARRAY == valueSchema.getType()) {
            return castArray((List<Object>) value, valueSchema, valueCastSchema, features);
        } else if (Type.MAP == valueSchema.getType()) {
            return castMap((Map<CharSequence, Object>)value, valueSchema, valueCastSchema, features);
        } else if (Type.RECORD == valueSchema.getType()) {
            return castRecord((GenericRecord)value, valueSchema, valueCastSchema, features);
        } else if (Type.UNION == valueSchema.getType()) {
            return castUnion(value, valueSchema, valueCastSchema, features);
        } else if (Type.ENUM == valueSchema.getType()) {
            return castEnumSymbol((GenericEnumSymbol) value, valueCastSchema, features);
        } else {
            return value;
        }
    }