|
| 1 | +/** |
| 2 | + * |
| 3 | + * Copyright 2017, Optimizely and contributors |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +package com.optimizely.ab.bucketing; |
| 18 | + |
| 19 | +import java.util.Map; |
| 20 | + |
| 21 | +/** |
| 22 | + * Class encapsulating user profile service functionality. |
| 23 | + * |
| 24 | + * Override with your own implementation for storing and retrieving the user profile. |
| 25 | + */ |
| 26 | +public interface UserProfileService { |
| 27 | + |
| 28 | + /** |
| 29 | + * Fetch the user profile map for the user ID. |
| 30 | + * |
| 31 | + * @param userId The ID of the user whose profile will be retrieved. |
| 32 | + * @return a Map representing the user's profile. |
| 33 | + * @throws Exception |
| 34 | + */ |
| 35 | + Map<String, Object> lookup(String userId) throws Exception; |
| 36 | + |
| 37 | + /** |
| 38 | + * Save the user profile Map sent to this method. |
| 39 | + * |
| 40 | + * @param userProfile The Map representing the user's profile. |
| 41 | + * @throws Exception Can throw an exception if the user profile was not saved properly. |
| 42 | + */ |
| 43 | + void save(Map<String, Object> userProfile) throws Exception; |
| 44 | +} |
0 commit comments