Annotation Type PortableProperty


  • @Target({FIELD,METHOD})
    @Retention(RUNTIME)
    @Deprecated
    public @interface PortableProperty
    Deprecated.
    Since Coherence 14.1.2. Use Portable annotation instead.
    A PortableProperty marks a member variable or method accessor as a POF serialized attribute. Whilst the value() and codec() can be explicitly specified they can be determined by classes that use this annotation. Hence these attributes serve as hints to the underlying parser.
    Since:
    3.7.1
    Author:
    hr
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<?> codec
      Deprecated.
      A Codec to use to override the default behavior in serializing and deserializing a property.
      int value
      Deprecated.
      The index of this property.
    • Element Detail

      • value

        int value
        Deprecated.
        The index of this property.
        Returns:
        POF index
        See Also:
        PofWriter
        Default:
        -1
      • codec

        Class<?> codec
        Deprecated.
        A Codec to use to override the default behavior in serializing and deserializing a property.

        The Class specified must have a no-arg constructor and must implement one of:

        1. Codec - the specified Codec implementation will be instantiated and returned.
        2. Collection - the specified class should implement the Collection interface. A Codec implementation that supports the Collection type will be used.
        3. Map - the specified class should implement the Map interface. A Codec implementation that supports the Map type will be used.
        4. LongArray - the specified class should implement the LongArray interface. A Codec implementation that supports the LongArray type will be used.
        5. T[] - the provided class should be an array and the component type of the array should have a no-arg constructor. A Codec implementation that supports arrays will be used.
        For example, to override the default serialization/deserialization to use a LinkedList implementation could be as trivial as:
        
             {@literal @}PortableProperty(value = 0, codec = LinkedList.class)
             protected List m_listPeople;
         
        A more complex example could be to specify a custom Codec implementation:
        
             {@literal @}PortableProperty(value = 0, codec = MyArrayListCodec.class)
             protected List m_listPeople;
        
             class MyArrayListCodec
                  implements Codec
                 {
                 public Object decode(PofReader in, int index)
                     throws IOException
                     {
                     in.readCollection(index, new ArrayList(16);
                     }
                 ...
                 }
         

        Returns:
        a Class representing the codec to use for this property, or a an implementation of a well known type (Collection, Map, LongArray, or an array)
        Default:
        com.tangosol.io.pof.reflect.Codecs.DefaultCodec.class