public TypeConstructor readConstructor()

in proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java [88:144]


    public TypeConstructor readConstructor(boolean excludeFastPathConstructors)
    {
        int code = ((int)readRawByte()) & 0xff;
        if(code == EncodingCodes.DESCRIBED_TYPE_INDICATOR)
        {
            final byte encoding = _buffer.get(_buffer.position());
            final Object descriptor;

            if (EncodingCodes.SMALLULONG == encoding || EncodingCodes.ULONG == encoding)
            {
                descriptor = readUnsignedLong(null);
            }
            else if (EncodingCodes.SYM8 == encoding || EncodingCodes.SYM32 == encoding)
            {
                descriptor = readSymbol(null);
            }
            else
            {
                descriptor = readObject();
            }

            if (!excludeFastPathConstructors)
            {
                TypeConstructor<?> fastPathTypeConstructor = _fastPathTypeConstructors.get(descriptor);
                if (fastPathTypeConstructor != null)
                {
                    return fastPathTypeConstructor;
                }
            }

            TypeConstructor<?> nestedEncoding = readConstructor(false);
            DescribedTypeConstructor<?> dtc = _dynamicTypeConstructors.get(descriptor);
            if(dtc == null)
            {
                dtc = new DescribedTypeConstructor()
                {
                    @Override
                    public DescribedType newInstance(final Object described)
                    {
                        return new UnknownDescribedType(descriptor, described);
                    }

                    @Override
                    public Class<?> getTypeClass()
                    {
                        return UnknownDescribedType.class;
                    }
                };
                register(descriptor, dtc);
            }
            return new DynamicTypeConstructor(dtc, nestedEncoding);
        }
        else
        {
            return _constructors[code];
        }
    }