class PartitionClientContext {
    /** Number of partitions. */
    private int parts;

    /** Mask to use in calculation when partitions count is power of 2. */
    private int mask;

    /**
     * Constructor.
     *
     * @param parts Partitions count.
     */
    public PartitionClientContext(int parts) {
        assert parts <= CacheConfiguration.MAX_PARTITIONS_COUNT;
        assert parts > 0;

        this.parts = parts;

        mask = RendezvousAffinityFunction.calculateMask(parts);
    }

    /**
     * Resolve partition.
     *
     * @param arg Argument.
     * @param typ Type.
     * @return Partition or {@code null} if cannot be resolved.
     */
    @Nullable public Integer partition(Object arg, @Nullable PartitionParameterType typ) {<FILL_FUNCTION_BODY>}
}

        if (typ == null)
            return null;

        Object key = PartitionDataTypeUtils.convert(arg, typ);

        if (key == PartitionDataTypeUtils.CONVERTATION_FAILURE)
            return null;

        if (key == null)
            return null;

        return RendezvousAffinityFunction.calculatePartition(key, mask, parts);
    
<no_super_class>