PrimaryIndexBucketLocatorImpl implements BucketLocator { public static Long convertObjectToBucketingToken(Object toBeConverted, FieldDataType dataType) { if (dataType == null) { throw new IllegalArgumentException("Data type must not be null."); } if (toBeConverted == null) { return null; } if (dataType.equals(FieldDataType.BINARY)) { return convertBinaryBase64ToLong((String) toBeConverted); } else if (dataType.equals(FieldDataType.BOOLEAN)) { Boolean temp = (Boolean) toBeConverted; if (temp) { return 1L; } else { return 0L; } } else if (dataType.equals(FieldDataType.DATE_TIME)) { return convertDateToBucketingLong((Date) toBeConverted); } else if (dataType.equals(FieldDataType.TIMEPOINT)) { return convertTimepointToBucketingLong((Date) toBeConverted); } else if (dataType.equals(FieldDataType.LONG)) { return (Long) toBeConverted; } else if (dataType.equals(FieldDataType.DOUBLE)) { return convertDoubleToLong((Double) toBeConverted); } else if (dataType.equals(FieldDataType.INTEGER)) { return convertIntegerToBucketingLong((Integer) toBeConverted); } else if (dataType.equals(FieldDataType.TEXT)) { return convertStringToBuckectingLong((String) toBeConverted); } else if (dataType.equals(FieldDataType.UUID)) { return convertUuidToLong((UUID) toBeConverted); } else { throw new UnsupportedOperationException(dataType + " is not a valid data type."); } } private  PrimaryIndexBucketLocatorImpl(); @Deprecated  PrimaryIndexBucketLocatorImpl(List<Long> textBuckets, List<Long> dateTimeBuckets,
            List<Long> doubleBuckets, List<Long> integerBuckets, List<Long> booleanBuckets,
            List<Long> uuidBuckets, List<Long> binaryBuckets, List<Long> longBuckets, List<Long> timepointBuckets); static PrimaryIndexBucketLocatorImpl getInstance(); @Override Long getBucket(Object bucketingObject, FieldDataType dataType); static Long convertObjectToBucketingToken(Object toBeConverted, FieldDataType dataType); static List<Long>[] getBUCKETS();  }
@Test public void testConvertObjectToBucketingToken() { assertEquals(PrimaryIndexBucketLocatorImpl.convertObjectToBucketingToken(new Boolean(true), FieldDataType.BOOLEAN), new Long(1L)); assertEquals(PrimaryIndexBucketLocatorImpl.convertObjectToBucketingToken(new Boolean(false), FieldDataType.BOOLEAN), new Long(0L)); }