enum behavior in REST

classic Classic list List threaded Threaded
3 messages Options
mvolkomorov mvolkomorov
Reply | Threaded
Open this post in threaded view
|

enum behavior in REST

I have "type":{"platformType":false}" in REST response for my
enum object property.

Object property:
public class Organization {
//...
private OrganizationType type;
//...
   public OrganizationType type() {
        return type;
    }
//...
}

OrganizationType :
public enum OrganizationType {
    /** Non-profit organization. */
    NON_PROFIT,

    /** Private organization. */
    PRIVATE,

    /** Government organization. */
    GOVERNMENT
}

I have correct deserializing at log:

... type=PRIVATE ...

Should I make custom deserialization for REST requests? Could I make a custom REST method for retrieving some fields of object?
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: enum behavior in REST

Hello!

Can you provide an example of REST response? I don't understand how this issue manifests.

Regards,
--
Ilya Kasnacheev


ср, 8 июл. 2020 г. в 01:25, Maxim Volkomorov <[hidden email]>:
I have "type":{"platformType":false}" in REST response for my
enum object property.

Object property:
public class Organization {
//...
private OrganizationType type;
//...
   public OrganizationType type() {
        return type;
    }
//...
}

OrganizationType :
public enum OrganizationType {
    /** Non-profit organization. */
    NON_PROFIT,

    /** Private organization. */
    PRIVATE,

    /** Government organization. */
    GOVERNMENT
}

I have correct deserializing at log:

... type=PRIVATE ...

Should I make custom deserialization for REST requests? Could I make a custom REST method for retrieving some fields of object?
mvolkomorov mvolkomorov
Reply | Threaded
Open this post in threaded view
|

Re: enum behavior in REST

Hi!

http://localhost:8080/ignite?cmd=get&cacheName=eventors&keyType=string&key=12345

{"successStatus":0,"affinityNodeId":"a34539ec-9c1a-44f9-b400-5d9b63a8a72c","error":null,"sessionToken":null,"response":{"date":"Jul 14, 2020 9:34:35 AM","score":1,"eventorStatus":{"platformType":false},"eventorUuid":"bd71b9c5-445a-4cf7-8ad1-8b7f27817412","events":{"3333":{"recordTimestamp":"Jul 14, 2020 8:56:53 AM","deliveryTimestamp":"Jul 14, 2020 9:54:13 AM","score":1}},"targetScore":10}}

I mentioned "eventorStatus":{"platformType":false} in previous message.
I tried to specify a getter explicitly for eventorStatus property with no effect.

пт, 10 июл. 2020 г. в 15:15, Ilya Kasnacheev <[hidden email]>:
Hello!

Can you provide an example of REST response? I don't understand how this issue manifests.

Regards,
--
Ilya Kasnacheev


ср, 8 июл. 2020 г. в 01:25, Maxim Volkomorov <[hidden email]>:
I have "type":{"platformType":false}" in REST response for my
enum object property.

Object property:
public class Organization {
//...
private OrganizationType type;
//...
   public OrganizationType type() {
        return type;
    }
//...
}

OrganizationType :
public enum OrganizationType {
    /** Non-profit organization. */
    NON_PROFIT,

    /** Private organization. */
    PRIVATE,

    /** Government organization. */
    GOVERNMENT
}

I have correct deserializing at log:

... type=PRIVATE ...

Should I make custom deserialization for REST requests? Could I make a custom REST method for retrieving some fields of object?