The simplest place is source code [1] [2]:

    public static boolean knownMap(Object map) {
        Class<?> cls = map == null ? null : map.getClass();

        return cls == HashMap.class ||
            cls == LinkedHashMap.class ||
            (!wrapTrees() && cls == TreeMap.class) ||
            cls == ConcurrentHashMap.class;
    }


    public static boolean knownCollection(Object col) {
        Class<?> cls = col == null ? null : col.getClass();

        return cls == HashSet.class ||
            cls == LinkedHashSet.class ||
            (!wrapTrees() && cls == TreeSet.class) ||
            cls == ConcurrentSkipListSet.class ||
            cls == ArrayList.class ||
            cls == LinkedList.class ||
            cls == SINGLETON_LIST_CLS;
    }


[1] 
https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java#L723
[2] 
https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java#L671


> 14 февр. 2023 г., в 15:02, Dinakar Devineni <dina....@gmail.com> написал(а):
> 
> 
> Thanks for the answer, it works now, as i changed it to arraylist.
> 
> Where can i find the supported list implementations?
> 
> On Tue, Feb 14, 2023 at 3:23 AM Николай Ижиков <nizhi...@apache.org 
> <mailto:nizhi...@apache.org>> wrote:
>> Hello.
>> 
>> The trick here is the following line
>> 
>> > car.setInspirations(List.of(new Car(), new Car()));
>> 
>> Ignite serialize as a binary collection only *some* implementation of List 
>> interface.
>> Others serialized using standard java serialization.
>> 
>> I rewrite your code and now it’s working as expected:
>> 
>> ```
>> public class SimpleTest extends GridCommonAbstractTest {
>>     @Test
>>     public void testGetCarInspirationsWithBinaryapi() throws Exception {
>>         Ignite ignite = startGrid(0);
>> 
>>         Car car = new Car();
>>         car.setName("carname");
>>         car.setWeight(BigDecimal.ONE);
>> 
>>         List<Car> inspirations = new ArrayList<>();
>> 
>>         inspirations.add(new Car());
>>         inspirations.add(new Car());
>> 
>>         car.setInspirations(inspirations);
>> 
>>         ignite.getOrCreateCache("Sample").put("carname", car);
>> 
>>         IgniteCache<String, BinaryObject> binaryCarCache = 
>> ignite.getOrCreateCache("Sample").withKeepBinary();
>> 
>>         List<BinaryObject> carInspirations = 
>> binaryCarCache.get("carname").field("inspirations");
>> 
>>         assertEquals(2, carInspirations.size());
>>         assertTrue(carInspirations.get(0) instanceof BinaryObject);
>> 
>>         BinaryObject binaryCar = carInspirations.get(0);
>> 
>>         assertNull(binaryCar.field("name"));
>>     }
>> 
>>     public class Car implements Serializable {
>>         private String name;
>>         private List<Car> inspirations;
>>         private BigDecimal weight;
>> 
>>         public String getName() {
>>             return name;
>>         }
>> 
>>         public void setName(String name) {
>>             this.name = name;
>>         }
>> 
>>         public List<Car> getInspirations() {
>>             return inspirations;
>>         }
>> 
>>         public void setInspirations(List<Car> inspirations) {
>>             this.inspirations = inspirations;
>>         }
>> 
>>         public BigDecimal getWeight() {
>>             return weight;
>>         }
>> 
>>         public void setWeight(BigDecimal weight) {
>>             this.weight = weight;
>>         }
>>     }
>> }
>> ```
>> 
>> 
>>> 14 февр. 2023 г., в 09:07, Mikhail Pochatkin <m.a.pochat...@gmail.com 
>>> <mailto:m.a.pochat...@gmail.com>> написал(а):
>>> 
>>> Hi, Dinakar.
>>> 
>>> Thanks for your question! Could you please provide doc references where you 
>>> found that it should be possible?
>>> 
>>> вт, 14 февр. 2023 г. в 07:18, Dinakar Devineni <dina....@gmail.com 
>>> <mailto:dina....@gmail.com>>:
>>>> Hi,
>>>> 
>>>>  
>>>> 
>>>> Appreciate  some help, to  understand  why is  this  failing  and  how  to 
>>>> correct this.
>>>> 
>>>>  
>>>> 
>>>> Trying to  read  a  list of  binary  objects form a  composite  data 
>>>> structure
>>>> 
>>>> Here  is the  sample code.  As  per  ignite  documentation this  should be 
>>>>  possible.
>>>> 
>>>>  
>>>> 
>>>>  
>>>> 
>>>> @Getter
>>>> 
>>>> @Setter
>>>> 
>>>> Public class Car implements Serializable {
>>>> 
>>>> private String name;
>>>> 
>>>> private List<Car> inspirations;
>>>> 
>>>> private BigDecimal weight;
>>>> 
>>>> }
>>>> 
>>>>  
>>>> 
>>>>  
>>>> 
>>>> @Test
>>>> 
>>>> Public void testGetCarInspirationsWith Binaryapi(){
>>>> 
>>>>  
>>>> 
>>>> Ignite ignite = Ignition.start();
>>>> 
>>>>  
>>>> 
>>>> Car car = new Car();
>>>> 
>>>> car.setName(“carname”);
>>>> 
>>>> car.setWeight(BigDecimal.ONE);
>>>> 
>>>> car.setInspirations(List.of(new Car(), new Car()));
>>>> 
>>>>  
>>>> 
>>>>  
>>>> 
>>>> ignite.getOrCreateCache(“Sample”).put("carname”, car);
>>>> 
>>>> IgniteCache<String, BinaryObject> binaryCarCache = 
>>>> ignite.getOrCreateCache(“Sample”).withKeepBinary();
>>>> 
>>>>  
>>>> 
>>>> // this  line is not  returning list  of  binary objects, rather  
>>>> returning desrialize  objects
>>>> 
>>>> List<BinaryObject> carInspirations = 
>>>> binaryCache.get(“carname”).field(“inspirations”);
>>>> 
>>>>  
>>>> 
>>>> }
>>>> 
>>>>  
>>>> 
>>>>  
>>>> 
>>>> Tech
>>>> 
>>>> Java 11
>>>> 
>>>> Ignite 2.14
>>>> 
>>>>  
>>>> 
>>>>  
>>>> 
>>>> Thanks
>>>> 
>>>> D
>>>> 
>>>>  
>>>> 
>>> 
>> 
>>> 
>>> -- 
>>> best regards,
>>> Pochatkin Mikhail.
>> 
> -- 
> Regards,
> Dinakar Devineni

Reply via email to