} else {
System.out.println("No keys were created.");
}
// Create custom targeting value for the predefined gender key.
CustomTargetingValue genderMaleValue = new CustomTargetingValue();
genderMaleValue.setCustomTargetingKeyId(keys[0].getId());
genderMaleValue.setDisplayName("male");
// Name is set to 1 so that the actual name can be hidden from website
// users.
genderMaleValue.setName("1");
genderMaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);
CustomTargetingValue genderFemaleValue = new CustomTargetingValue();
genderFemaleValue.setCustomTargetingKeyId(keys[0].getId());
genderFemaleValue.setDisplayName("female");
// Name is set to 2 so that the actual name can be hidden from website
// users.
genderFemaleValue.setName("2");
genderFemaleValue.setMatchType(CustomTargetingValueMatchType.EXACT);
// Create custom targeting value for the predefined genre key.
CustomTargetingValue genreComedyValue = new CustomTargetingValue();
genreComedyValue.setCustomTargetingKeyId(keys[1].getId());
genreComedyValue.setDisplayName("comedy");
genreComedyValue.setName("comedy");
genreComedyValue.setMatchType(CustomTargetingValueMatchType.EXACT);
CustomTargetingValue genreDramaValue = new CustomTargetingValue();
genreDramaValue.setCustomTargetingKeyId(keys[1].getId());
genreDramaValue.setDisplayName("drama");
genreDramaValue.setName("drama");
genreDramaValue.setMatchType(CustomTargetingValueMatchType.EXACT);
// Create custom targeting value for the free-form age key. These are
// values that would be suggested in the UI or can be used when targeting
// with a {@link FreeFormCustomCriteria}.
CustomTargetingValue carModelHondaCivicValue = new CustomTargetingValue();
carModelHondaCivicValue.setCustomTargetingKeyId(keys[2].getId());
carModelHondaCivicValue.setDisplayName("honda civic");
carModelHondaCivicValue.setName("honda civic");
// Setting match type to exact will match exactly "honda civic".
carModelHondaCivicValue.setMatchType(CustomTargetingValueMatchType.EXACT);
// Create the custom targeting values on the server.
CustomTargetingValue[] returnValues =
customTargetingService.createCustomTargetingValues(new CustomTargetingValue[] {
genderMaleValue, genderFemaleValue, genreComedyValue, genreDramaValue,