Interface ImmutableSerializationContext

    • Method Detail

      • getConfiguration

        Configuration getConfiguration()
        Get the (immutable) configuration object that was used when creating this context.
      • getFileDescriptors

        Map<String,​FileDescriptor> getFileDescriptors()
        Obtain the currently registered file descriptors.
        Returns:
        an immutable copy of the internal map of descriptors
      • getGenericDescriptors

        Map<String,​GenericDescriptor> getGenericDescriptors()
        Obtain the currently registered type descriptors.
        Returns:
        an immutable copy of the internal map of descriptors
      • canMarshall

        boolean canMarshall​(Class<?> javaClass)
        Checks if the given type (message or enum) can be marshalled. This checks that a marshaller was registered for it.
        Parameters:
        javaClass - the object or enum class to check
        Returns:
        true if a marshaller exists, false otherwise
      • canMarshall

        boolean canMarshall​(String fullTypeName)
        Checks if the given type (message or enum) can be marshalled. This checks that the Protobuf type was defined and a marshaller was registered for it.
        Parameters:
        fullTypeName - the fully qualified name of the Protobuf definition to check
        Returns:
        true if a marshaller exists, false otherwise
      • canMarshall

        boolean canMarshall​(Object object)
        Checks if the given instance can be marshalled.
        Parameters:
        object - the instance
        Returns:
        true if a marshaller exists, false otherwise
      • getMarshaller

        <T> BaseMarshaller<T> getMarshaller​(T object)
        Obtains the marshaller associated with a given instance.
        Parameters:
        object - the instance
        Returns:
        the marshaller
        Throws:
        IllegalArgumentException - if the given instance does not have a suitable marshaller registered
      • getMarshaller

        <T> BaseMarshaller<T> getMarshaller​(String fullTypeName)
        Obtains the marshaller associated with a Protobuf type name.
        Parameters:
        fullTypeName - the type name
        Returns:
        the marshaller
        Throws:
        IllegalArgumentException - if the given type name is not known to this context
      • getMarshaller

        <T> BaseMarshaller<T> getMarshaller​(Class<T> clazz)
        Obtains the marshaller associated with a Java type.
        Parameters:
        clazz - the class
        Returns:
        the marshaller
        Throws:
        IllegalArgumentException - if the given Java type is not known to this context
      • getTypeNameById

        @Deprecated
        String getTypeNameById​(Integer typeId)
        Deprecated.
        since 4.2.2, to be removed in 5, replaced by getDescriptorByTypeId(typeId).getFullName()
        Obtains the Protobuf type name associated with a numeric type id.
        Parameters:
        typeId - the numeric type id
        Returns:
        the fully qualified type name
        Throws:
        IllegalArgumentException - if the given type id is not known to this context
      • getTypeIdByName

        @Deprecated
        Integer getTypeIdByName​(String fullTypeName)
        Deprecated.
        since 4.2.2, to be removed in 5, replaced by getDescriptorByName(fullTypeName).getTypeId()
        Obtains the associated numeric type id for a Protobuf type name, if a numeric id was defined.
        Parameters:
        fullTypeName - the fully qualified type name
        Returns:
        the type id or null if no type id is associated with the type
        Throws:
        IllegalArgumentException - if the given type name is not known to this context
      • getDescriptorByTypeId

        GenericDescriptor getDescriptorByTypeId​(Integer typeId)
        Obtains the descriptor associated with a numeric type id.
        Parameters:
        typeId - the numeric type id
        Returns:
        the descriptor
        Throws:
        IllegalArgumentException - if the given type id is not known to this context
      • getDescriptorByName

        GenericDescriptor getDescriptorByName​(String fullTypeName)
        Obtains the descriptor associated with a type name.
        Parameters:
        fullTypeName - the fully qualified type name
        Returns:
        the descriptor
        Throws:
        IllegalArgumentException - if the given type name is not known to this context