Skip to content

any'ness of id's - how to use it in a generic client #659

Answered by hylkevds
lathoub asked this question in Q&A
Discussion options

You must be logged in to vote

You can't have different IDs in the same table / entity type, they're either a Number or a String.

FROST Client (java) does indeed test if the JSON entity in the parse tree is a number or not:

https://github.com/FraunhoferIOSB/FROST-Client/blob/cc8508e1108743412261a5bf069f8593624a5747/src/main/java/de/fraunhofer/iosb/ilt/sta/jackson/IdDeserializer.java#L35-L39

        JsonNode node = parser.getCodec().readTree(parser);
        if (node.isNumber()) {
            return new IdLong(node.asLong());
        }
        return new IdString(node.asText());

The different implementations of the {ID interface](https://github.com/FraunhoferIOSB/FROST-Client/blob/cc8508e1108743412261a5bf069f8593624a57…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
Answer selected by lathoub
Comment options

You must be logged in to vote
1 reply
@lathoub
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants