In Hadoop, data types to be used as the key must implement WritableComparable interface and data types to be used as value must implement Writable interface.
If your custom key/value are of the same type then you can write one custom datatype for both the key/value which implements WritableComparable otherwise you need to implement two different data types. One for the key which implements the WritableComparable interface and other for value which implements Writable interface.
public class MyCustomeKey implements WritableComparable
//Create Mapper with Custome Key
public class MyMapper extends Mapper