Class PolymorphicCollectionSchema

  • All Implemented Interfaces:
    Schema<java.lang.Object>

    public abstract class PolymorphicCollectionSchema
    extends PolymorphicSchema
    Used when the type is an interface (Collection/List/Set/SortedSet).
    • Field Detail

      • ID_UNMODIFIABLE_COLLECTION

        static final int ID_UNMODIFIABLE_COLLECTION
        See Also:
        Constant Field Values
      • ID_UNMODIFIABLE_SORTED_SET

        static final int ID_UNMODIFIABLE_SORTED_SET
        See Also:
        Constant Field Values
      • ID_UNMODIFIABLE_RANDOM_ACCESS_LIST

        static final int ID_UNMODIFIABLE_RANDOM_ACCESS_LIST
        See Also:
        Constant Field Values
      • ID_SYNCHRONIZED_COLLECTION

        static final int ID_SYNCHRONIZED_COLLECTION
        See Also:
        Constant Field Values
      • ID_SYNCHRONIZED_SORTED_SET

        static final int ID_SYNCHRONIZED_SORTED_SET
        See Also:
        Constant Field Values
      • ID_SYNCHRONIZED_RANDOM_ACCESS_LIST

        static final int ID_SYNCHRONIZED_RANDOM_ACCESS_LIST
        See Also:
        Constant Field Values
      • ID_CHECKED_RANDOM_ACCESS_LIST

        static final int ID_CHECKED_RANDOM_ACCESS_LIST
        See Also:
        Constant Field Values
      • STR_UNMODIFIABLE_COLLECTION

        static final java.lang.String STR_UNMODIFIABLE_COLLECTION
        See Also:
        Constant Field Values
      • STR_UNMODIFIABLE_SET

        static final java.lang.String STR_UNMODIFIABLE_SET
        See Also:
        Constant Field Values
      • STR_UNMODIFIABLE_SORTED_SET

        static final java.lang.String STR_UNMODIFIABLE_SORTED_SET
        See Also:
        Constant Field Values
      • STR_UNMODIFIABLE_LIST

        static final java.lang.String STR_UNMODIFIABLE_LIST
        See Also:
        Constant Field Values
      • STR_UNMODIFIABLE_RANDOM_ACCESS_LIST

        static final java.lang.String STR_UNMODIFIABLE_RANDOM_ACCESS_LIST
        See Also:
        Constant Field Values
      • STR_SYNCHRONIZED_COLLECTION

        static final java.lang.String STR_SYNCHRONIZED_COLLECTION
        See Also:
        Constant Field Values
      • STR_SYNCHRONIZED_SET

        static final java.lang.String STR_SYNCHRONIZED_SET
        See Also:
        Constant Field Values
      • STR_SYNCHRONIZED_SORTED_SET

        static final java.lang.String STR_SYNCHRONIZED_SORTED_SET
        See Also:
        Constant Field Values
      • STR_SYNCHRONIZED_LIST

        static final java.lang.String STR_SYNCHRONIZED_LIST
        See Also:
        Constant Field Values
      • STR_SYNCHRONIZED_RANDOM_ACCESS_LIST

        static final java.lang.String STR_SYNCHRONIZED_RANDOM_ACCESS_LIST
        See Also:
        Constant Field Values
      • STR_CHECKED_COLLECTION

        static final java.lang.String STR_CHECKED_COLLECTION
        See Also:
        Constant Field Values
      • STR_CHECKED_SORTED_SET

        static final java.lang.String STR_CHECKED_SORTED_SET
        See Also:
        Constant Field Values
      • STR_CHECKED_RANDOM_ACCESS_LIST

        static final java.lang.String STR_CHECKED_RANDOM_ACCESS_LIST
        See Also:
        Constant Field Values
      • __nonPublicCollections

        static final java.util.IdentityHashMap<java.lang.Class<?>,​java.lang.Integer> __nonPublicCollections
      • fSingletonSet_element

        static final java.lang.reflect.Field fSingletonSet_element
      • fSingletonList_element

        static final java.lang.reflect.Field fSingletonList_element
      • fUnmodifiableCollection_c

        static final java.lang.reflect.Field fUnmodifiableCollection_c
      • fUnmodifiableSortedSet_ss

        static final java.lang.reflect.Field fUnmodifiableSortedSet_ss
      • fUnmodifiableList_list

        static final java.lang.reflect.Field fUnmodifiableList_list
      • fSynchronizedCollection_c

        static final java.lang.reflect.Field fSynchronizedCollection_c
      • fSynchronizedSortedSet_ss

        static final java.lang.reflect.Field fSynchronizedSortedSet_ss
      • fSynchronizedList_list

        static final java.lang.reflect.Field fSynchronizedList_list
      • fSynchronizedCollection_mutex

        static final java.lang.reflect.Field fSynchronizedCollection_mutex
      • fCheckedCollection_c

        static final java.lang.reflect.Field fCheckedCollection_c
      • fCheckedSortedSet_ss

        static final java.lang.reflect.Field fCheckedSortedSet_ss
      • fCheckedList_list

        static final java.lang.reflect.Field fCheckedList_list
      • fCheckedCollection_type

        static final java.lang.reflect.Field fCheckedCollection_type
      • fSetFromMap_m

        static final java.lang.reflect.Field fSetFromMap_m
      • fSetFromMap_s

        static final java.lang.reflect.Field fSetFromMap_s
      • fCopiesList_n

        static final java.lang.reflect.Field fCopiesList_n
      • fCopiesList_element

        static final java.lang.reflect.Field fCopiesList_element
      • pipeSchema

        protected final Pipe.Schema<java.lang.Object> pipeSchema
    • Constructor Detail

      • PolymorphicCollectionSchema

        public PolymorphicCollectionSchema​(IdStrategy strategy)
    • Method Detail

      • map

        private static java.lang.Class<?> map​(java.lang.String className,
                                              int id)
      • name

        static java.lang.String name​(int number)
      • number

        static int number​(java.lang.String name)
      • number

        static int number​(char c)
      • getFieldName

        public java.lang.String getFieldName​(int number)
        Description copied from interface: Schema
        Gets the field name associated with the number. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:
         return String.valueOf(number);
         
      • getFieldNumber

        public int getFieldNumber​(java.lang.String name)
        Description copied from interface: Schema
        Gets the field number associated with the name. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:
         return Integer.parseInt(name);
         
      • messageFullName

        public java.lang.String messageFullName()
        Description copied from interface: Schema
        Returns the full name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getName();
      • messageName

        public java.lang.String messageName()
        Description copied from interface: Schema
        Returns the simple name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getSimpleName();
      • mergeFrom

        public void mergeFrom​(Input input,
                              java.lang.Object owner)
                       throws java.io.IOException
        Description copied from interface: Schema
        Deserializes a message/object from the input.
        Throws:
        java.io.IOException
      • writeTo

        public void writeTo​(Output output,
                            java.lang.Object value)
                     throws java.io.IOException
        Description copied from interface: Schema
        Serializes a message/object to the output.
        Throws:
        java.io.IOException
      • idFrom

        static int idFrom​(java.lang.Class<?> clazz)
      • instanceFrom

        static java.lang.Object instanceFrom​(int id)
      • writeObjectTo

        static void writeObjectTo​(Output output,
                                  java.lang.Object value,
                                  Schema<?> currentSchema,
                                  IdStrategy strategy)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • writeNonPublicCollectionTo

        static void writeNonPublicCollectionTo​(Output output,
                                               java.lang.Object value,
                                               Schema<?> currentSchema,
                                               IdStrategy strategy)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeUnmodifiableCollectionTo

        private static void writeUnmodifiableCollectionTo​(Output output,
                                                          java.lang.Object value,
                                                          Schema<?> currentSchema,
                                                          IdStrategy strategy,
                                                          int id)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeSynchronizedCollectionTo

        private static void writeSynchronizedCollectionTo​(Output output,
                                                          java.lang.Object value,
                                                          Schema<?> currentSchema,
                                                          IdStrategy strategy,
                                                          int id)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeCheckedCollectionTo

        private static void writeCheckedCollectionTo​(Output output,
                                                     java.lang.Object value,
                                                     Schema<?> currentSchema,
                                                     IdStrategy strategy,
                                                     int id)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • readObjectFrom

        static java.lang.Object readObjectFrom​(Input input,
                                               Schema<?> schema,
                                               java.lang.Object owner,
                                               IdStrategy strategy)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readObjectFrom

        static java.lang.Object readObjectFrom​(Input input,
                                               Schema<?> schema,
                                               java.lang.Object owner,
                                               IdStrategy strategy,
                                               int number)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readUnmodifiableCollectionFrom

        private static java.lang.Object readUnmodifiableCollectionFrom​(Input input,
                                                                       Schema<?> schema,
                                                                       java.lang.Object owner,
                                                                       IdStrategy strategy,
                                                                       boolean graph,
                                                                       java.lang.Object collection,
                                                                       boolean ss,
                                                                       boolean list)
                                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readSynchronizedCollectionFrom

        private static java.lang.Object readSynchronizedCollectionFrom​(Input input,
                                                                       Schema<?> schema,
                                                                       java.lang.Object owner,
                                                                       IdStrategy strategy,
                                                                       boolean graph,
                                                                       java.lang.Object collection,
                                                                       boolean ss,
                                                                       boolean list)
                                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • readCheckedCollectionFrom

        private static java.lang.Object readCheckedCollectionFrom​(Input input,
                                                                  Schema<?> schema,
                                                                  java.lang.Object owner,
                                                                  IdStrategy strategy,
                                                                  boolean graph,
                                                                  java.lang.Object collection,
                                                                  boolean ss,
                                                                  boolean list)
                                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • transferObject

        static void transferObject​(Pipe.Schema<java.lang.Object> pipeSchema,
                                   Pipe pipe,
                                   Input input,
                                   Output output,
                                   IdStrategy strategy)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • transferObject

        static void transferObject​(Pipe.Schema<java.lang.Object> pipeSchema,
                                   Pipe pipe,
                                   Input input,
                                   Output output,
                                   IdStrategy strategy,
                                   int number)
                            throws java.io.IOException
        Throws:
        java.io.IOException