net.hamnaberg.json.codec.Decoders Maven / Gradle / Ivy
The newest version!
package net.hamnaberg.json.codec;
import net.hamnaberg.arities.*;
import net.hamnaberg.json.Json;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URL;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.function.BiFunction;
import java.util.function.Function;
public abstract class Decoders {
private Decoders(){}
public static final DecodeJson DIdentity = DecodeResult::ok;
public static final DecodeJson DString = value -> DecodeResult.fromOption(value.asString(), () -> String.format("%s is not a JString", value.getClass().getSimpleName()));
public static final DecodeJson DBigDecimal = value -> DecodeResult.fromOption(value.asBigDecimal(), () -> String.format("%s is not a JNumber", value.getClass().getSimpleName()));
public static final DecodeJson DNumber = DBigDecimal.map(bd -> (Number) bd);
public static final DecodeJson DLong = value -> DecodeResult.fromOption(value.asJsonNumber().map(Json.JNumber::asLong), () -> String.format("%s is not a JNumber", value.getClass().getSimpleName()));
public static final DecodeJson DInt = value -> DecodeResult.fromOption(value.asJsonNumber().map(Json.JNumber::asInt), () -> String.format("%s is not a JNumber", value.getClass().getSimpleName()));
public static final DecodeJson DDouble = value -> DecodeResult.fromOption(value.asJsonNumber().map(Json.JNumber::asDouble), () -> String.format("%s is not a JNumber", value.getClass().getSimpleName()));
public static final DecodeJson DBoolean = value -> DecodeResult.fromOption(value.asBoolean(), () -> String.format("%s is not a JBoolean", value.getClass().getSimpleName()));
public static final DecodeJson DUUID = DString.tryMap(s -> () -> UUID.fromString(s));
public static final DecodeJson DURI = DString.tryMap(s -> () -> URI.create(s));
public static final DecodeJson DURL = DURI.tryMap(uri -> uri::toURL);
public static final DecodeJson DISODateTimeUTC = zonedDateTimeDecoder(DateTimeFormatter.ISO_DATE_TIME.withZone(ZoneOffset.UTC));
public static final DecodeJson DISOInstantUTC = instantDecoder(DateTimeFormatter.ISO_INSTANT.withZone(ZoneOffset.UTC));
public static DecodeJson zonedDateTimeDecoder(DateTimeFormatter formatter) {
return DString.tryMap(s -> () -> ZonedDateTime.parse(s, formatter));
}
public static DecodeJson instantDecoder(DateTimeFormatter formatter) {
return DString.tryMap(s -> () -> formatter.parse(s, Instant::from));
}
public static DecodeJson> listDecoder(DecodeJson decoder) {
DecodeJson> outer = value -> DecodeResult.sequence(value.asJsonArrayOrEmpty().mapToList(decoder::fromJson));
return outer.withDefaultValue(List.of());
}
public static DecodeJson> setDecoder(DecodeJson decoder) {
return listDecoder(decoder).map(Set::copyOf).withDefaultValue(Set.of());
}
public static DecodeJson> optionalDecoder(DecodeJson decoder) {
DecodeJson> outerDecoder = value -> value.isNull() ? DecodeResult.ok(Optional.empty()) : DecodeResult.ok(decoder.fromJson(value).toOption());
return outerDecoder.withDefaultValue(Optional.empty());
}
public static DecodeJson objectDecoder(Function> decoder) {
return json -> decoder.apply(json.asJsonObjectOrEmpty());
}
public static DecodeJson decode(FieldDecoder Function, Function func) {
return (value) -> {
var oa = DecodeResult.decode(value.asJsonObjectOrEmpty(), Function);
return oa.flatMap(a -> DecodeResult.ok(func.apply(a)));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, BiFunction func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
return d1.flatMap(v1 -> d2.flatMap(v2 -> DecodeResult.ok(func.apply(v1, v2))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, Function3 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> DecodeResult.ok(func.apply(v1, v2, v3)))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, Function4 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> DecodeResult.ok(func.apply(v1, v2, v3, v4))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, Function5 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5)))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, Function6 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, Function7 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7)))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, Function8 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, Function9 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9)))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, Function10 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, Function11 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
var d11 = DecodeResult.decode(object, fd11);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> d11.flatMap(v11 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11)))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, FieldDecoder fd12, Function12 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
var d11 = DecodeResult.decode(object, fd11);
var d12 = DecodeResult.decode(object, fd12);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> d11.flatMap(v11 -> d12.flatMap(v12 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12))))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, FieldDecoder fd12, FieldDecoder fd13, Function13 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
var d11 = DecodeResult.decode(object, fd11);
var d12 = DecodeResult.decode(object, fd12);
var d13 = DecodeResult.decode(object, fd13);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> d11.flatMap(v11 -> d12.flatMap(v12 -> d13.flatMap(v13 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13)))))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, FieldDecoder fd12, FieldDecoder fd13, FieldDecoder fd14, Function14 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
var d11 = DecodeResult.decode(object, fd11);
var d12 = DecodeResult.decode(object, fd12);
var d13 = DecodeResult.decode(object, fd13);
var d14 = DecodeResult.decode(object, fd14);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> d11.flatMap(v11 -> d12.flatMap(v12 -> d13.flatMap(v13 -> d14.flatMap(v14 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14))))))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, FieldDecoder fd12, FieldDecoder fd13, FieldDecoder fd14, FieldDecoder fd15, Function15 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
var d11 = DecodeResult.decode(object, fd11);
var d12 = DecodeResult.decode(object, fd12);
var d13 = DecodeResult.decode(object, fd13);
var d14 = DecodeResult.decode(object, fd14);
var d15 = DecodeResult.decode(object, fd15);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> d11.flatMap(v11 -> d12.flatMap(v12 -> d13.flatMap(v13 -> d14.flatMap(v14 -> d15.flatMap(v15 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)))))))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, FieldDecoder fd12, FieldDecoder fd13, FieldDecoder fd14, FieldDecoder fd15, FieldDecoder fd16, Function16 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
var d11 = DecodeResult.decode(object, fd11);
var d12 = DecodeResult.decode(object, fd12);
var d13 = DecodeResult.decode(object, fd13);
var d14 = DecodeResult.decode(object, fd14);
var d15 = DecodeResult.decode(object, fd15);
var d16 = DecodeResult.decode(object, fd16);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> d11.flatMap(v11 -> d12.flatMap(v12 -> d13.flatMap(v13 -> d14.flatMap(v14 -> d15.flatMap(v15 -> d16.flatMap(v16 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16))))))))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, FieldDecoder fd12, FieldDecoder fd13, FieldDecoder fd14, FieldDecoder fd15, FieldDecoder fd16, FieldDecoder fd17, Function17 func) {
return (value) -> {
var object = value.asJsonObjectOrEmpty();
var d1 = DecodeResult.decode(object, fd1);
var d2 = DecodeResult.decode(object, fd2);
var d3 = DecodeResult.decode(object, fd3);
var d4 = DecodeResult.decode(object, fd4);
var d5 = DecodeResult.decode(object, fd5);
var d6 = DecodeResult.decode(object, fd6);
var d7 = DecodeResult.decode(object, fd7);
var d8 = DecodeResult.decode(object, fd8);
var d9 = DecodeResult.decode(object, fd9);
var d10 = DecodeResult.decode(object, fd10);
var d11 = DecodeResult.decode(object, fd11);
var d12 = DecodeResult.decode(object, fd12);
var d13 = DecodeResult.decode(object, fd13);
var d14 = DecodeResult.decode(object, fd14);
var d15 = DecodeResult.decode(object, fd15);
var d16 = DecodeResult.decode(object, fd16);
var d17 = DecodeResult.decode(object, fd17);
return d1.flatMap(v1 -> d2.flatMap(v2 -> d3.flatMap(v3 -> d4.flatMap(v4 -> d5.flatMap(v5 -> d6.flatMap(v6 -> d7.flatMap(v7 -> d8.flatMap(v8 -> d9.flatMap(v9 -> d10.flatMap(v10 -> d11.flatMap(v11 -> d12.flatMap(v12 -> d13.flatMap(v13 -> d14.flatMap(v14 -> d15.flatMap(v15 -> d16.flatMap(v16 -> d17.flatMap(v17 -> DecodeResult.ok(func.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)))))))))))))))))));
};
}
public static DecodeJson decode(FieldDecoder fd1, FieldDecoder fd2, FieldDecoder fd3, FieldDecoder fd4, FieldDecoder fd5, FieldDecoder fd6, FieldDecoder fd7, FieldDecoder fd8, FieldDecoder fd9, FieldDecoder fd10, FieldDecoder fd11, FieldDecoder fd12, FieldDecoder fd13, FieldDecoder fd14, FieldDecoder fd15, FieldDecoder fd16, FieldDecoder fd17, FieldDecoder fd18, Function18