public V unmarshall()

in lightning-core/src/main/java/org/apache/directmemory/lightning/internal/marshaller/SetMarshaller.java [111:156]


    public <V> V unmarshall( PropertyDescriptor propertyDescriptor, Source source,
                             SerializationContext serializationContext )
        throws IOException
    {
        if ( isNull( source ) )
        {
            return null;
        }

        int size = source.readInt();
        Set set = new HashSet( size );
        if ( size > 0 )
        {
            for ( int i = 0; i < size; i++ )
            {
                if ( isNull( source ) )
                {
                    set.add( null );
                }
                else
                {
                    long classId = source.readLong();
                    ClassDefinition classDefinition =
                        serializationContext.getClassDefinitionContainer().getClassDefinitionById( classId );

                    Marshaller marshaller;
                    if ( setType != null )
                    {
                        ensureMarshallerInitialized( serializationContext );
                        marshaller = setTypeMarshaller;
                    }
                    else
                    {
                        marshaller = serializationContext.findMarshaller( classDefinition.getType() );
                    }

                    PropertyDescriptor pd =
                        new CheatPropertyDescriptor( propertyDescriptor.getPropertyName() + "Set",
                                                     classDefinition.getType(), marshaller );
                    set.add( marshaller.unmarshall( pd, source, serializationContext ) );
                }
            }
        }

        return (V) set;
    }