class CosemDateConverter extends CustomConverter<byte[], CosemDate> {

    @Override
    public CosemDate convert(final byte[] source, final Type<? extends CosemDate> destinationType,
            final MappingContext context) {
        final ByteBuffer bb = ByteBuffer.wrap(source);
        final int year = bb.getShort() & 0xFFFF;
        final int month = bb.get() & 0xFF;
        final int day = bb.get() & 0xFF;
        final int weekDay = bb.get() & 0xFF;
        return new CosemDate(year, month, day, weekDay);
    }

}