Encodes the given element to an instance of the class T.
If the element does not contain all necessary entries, an exception will be thrown.