From 03e899149d7c1d75a58271414623870f5d1a3495 Mon Sep 17 00:00:00 2001 From: Jae Kim Date: Mon, 1 Mar 2021 14:10:14 -0800 Subject: [PATCH 1/2] fix all doc warnings --- .../java/com/optimizely/ab/Optimizely.java | 27 +++++++++++++ .../optimizely/ab/OptimizelyUserContext.java | 4 +- .../ab/config/DatafileProjectConfig.java | 3 +- .../ab/config/ProjectConfigUtils.java | 11 ++++++ .../config/audience/AudienceIdCondition.java | 2 +- .../config/audience/match/MatchRegistry.java | 4 +- .../audience/match/SemanticVersion.java | 5 +++ .../ab/config/parser/ConfigParser.java | 8 +++- .../ab/event/BatchEventProcessor.java | 22 +++++++++++ .../ab/internal/ConditionUtils.java | 4 ++ .../optimizely/ab/internal/EventTagUtils.java | 7 +++- .../optimizely/ab/internal/PropertyUtils.java | 38 +++++++++++++++++++ .../optimizely/ab/internal/SafetyUtils.java | 2 + .../ab/notification/ActivateNotification.java | 2 + .../ab/notification/NotificationCenter.java | 6 ++- .../ab/notification/TrackNotification.java | 2 + .../ab/optimizelyjson/OptimizelyJSON.java | 4 ++ .../com/optimizely/ab/OptimizelyFactory.java | 29 ++++++++++++-- .../ab/config/HttpProjectConfigManager.java | 8 ++++ .../ab/event/AsyncEventHandler.java | 9 +++++ 20 files changed, 182 insertions(+), 15 deletions(-) diff --git a/core-api/src/main/java/com/optimizely/ab/Optimizely.java b/core-api/src/main/java/com/optimizely/ab/Optimizely.java index fb62ded7f..8a7034d0e 100644 --- a/core-api/src/main/java/com/optimizely/ab/Optimizely.java +++ b/core-api/src/main/java/com/optimizely/ab/Optimizely.java @@ -1354,6 +1354,9 @@ public NotificationCenter getNotificationCenter() { /** * Convenience method for adding DecisionNotification Handlers + * + * @param handler DicisionNotification handler + * @return A handler Id (greater than 0 if succeeded) */ public int addDecisionNotificationHandler(NotificationHandler handler) { return addNotificationHandler(DecisionNotification.class, handler); @@ -1361,6 +1364,9 @@ public int addDecisionNotificationHandler(NotificationHandler handler) { return addNotificationHandler(TrackNotification.class, handler); @@ -1368,6 +1374,9 @@ public int addTrackNotificationHandler(NotificationHandler ha /** * Convenience method for adding UpdateConfigNotification Handlers + * + * @param handler UpdateConfigNotification handler + * @return A handler Id (greater than 0 if succeeded) */ public int addUpdateConfigNotificationHandler(NotificationHandler handler) { return addNotificationHandler(UpdateConfigNotification.class, handler); @@ -1375,6 +1384,9 @@ public int addUpdateConfigNotificationHandler(NotificationHandler handler) { return addNotificationHandler(LogEvent.class, handler); @@ -1382,6 +1394,11 @@ public int addLogEventNotificationHandler(NotificationHandler handler) /** * Convenience method for adding NotificationHandlers + * + * @param clazz The class of NotificationHandler + * @param handler NotificationHandler handler + * @param This is the type parameter + * @return A handler Id (greater than 0 if succeeded) */ public int addNotificationHandler(Class clazz, NotificationHandler handler) { return notificationCenter.addNotificationHandler(clazz, handler); @@ -1403,6 +1420,10 @@ public int addNotificationHandler(Class clazz, NotificationHandler han * .withEventHandler(eventHandler) * .build(); * + * + * @param datafile A datafile + * @param eventHandler An EventHandler + * @return An Optimizely builder */ @Deprecated public static Builder builder(@Nonnull String datafile, @@ -1460,6 +1481,9 @@ public Builder withErrorHandler(ErrorHandler errorHandler) { * method. * {@link com.optimizely.ab.event.BatchEventProcessor.Builder#withEventHandler(com.optimizely.ab.event.EventHandler)} label} * Please use that builder method instead. + * + * @param eventHandler An EventHandler + * @return An Optimizely builder */ @Deprecated public Builder withEventHandler(EventHandler eventHandler) { @@ -1469,6 +1493,9 @@ public Builder withEventHandler(EventHandler eventHandler) { /** * You can instantiate a BatchEventProcessor or a ForwardingEventProcessor or supply your own. + * + * @param eventProcessor An EventProcessor + * @return An Optimizely builder */ public Builder withEventProcessor(EventProcessor eventProcessor) { this.eventProcessor = eventProcessor; diff --git a/core-api/src/main/java/com/optimizely/ab/OptimizelyUserContext.java b/core-api/src/main/java/com/optimizely/ab/OptimizelyUserContext.java index 55f380753..f9cff6f44 100644 --- a/core-api/src/main/java/com/optimizely/ab/OptimizelyUserContext.java +++ b/core-api/src/main/java/com/optimizely/ab/OptimizelyUserContext.java @@ -155,7 +155,7 @@ public Map decideAll() { * * @param eventName The event name. * @param eventTags A map of event tag names to event tag values. - * @throws UnknownEventTypeException + * @throws UnknownEventTypeException when event type is unknown */ public void trackEvent(@Nonnull String eventName, @Nonnull Map eventTags) throws UnknownEventTypeException { @@ -166,7 +166,7 @@ public void trackEvent(@Nonnull String eventName, * Track an event. * * @param eventName The event name. - * @throws UnknownEventTypeException + * @throws UnknownEventTypeException when event type is unknown */ public void trackEvent(@Nonnull String eventName) throws UnknownEventTypeException { trackEvent(eventName, Collections.emptyMap()); diff --git a/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java b/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java index 786d13a2c..fa8f1b56b 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java +++ b/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java @@ -278,7 +278,7 @@ private List aggregateGroupExperiments(List groups) { /** * Checks is attributeKey is reserved or not and if it exist in attributeKeyMapping * - * @param attributeKey + * @param attributeKey The attribute key * @return AttributeId corresponding to AttributeKeyMapping, AttributeKey when it's a reserved attribute and * null when attributeKey is equal to BOT_FILTERING_ATTRIBUTE key. */ @@ -484,6 +484,7 @@ public Builder withDatafile(String datafile) { /** * @return a {@link DatafileProjectConfig} instance given a JSON string datafile + * @throws ConfigParseException when parsing datafile fails */ public ProjectConfig build() throws ConfigParseException { if (datafile == null) { diff --git a/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java b/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java index 1d1978096..6aa4f05a3 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java @@ -26,6 +26,10 @@ public class ProjectConfigUtils { /** * Helper method for creating convenience mappings from key to entity + * + * @param nameables The list of IdMapped entities + * @param This is the type parameter + * @return The map of key to entity */ public static Map generateNameMapping(List nameables) { Map nameMapping = new HashMap(); @@ -38,6 +42,10 @@ public static Map generateNameMapping(List /** * Helper method for creating convenience mappings from ID to entity + * + * @param nameables The list of IdMapped entities + * @param This is the type parameter + * @return The map of ID to entity */ public static Map generateIdMapping(List nameables) { Map nameMapping = new HashMap(); @@ -50,6 +58,9 @@ public static Map generateIdMapping(List name /** * Helper method for creating convenience mappings of ExperimentID to featureFlags it is included in. + * + * @param featureFlags The list of feture flags + * @return The mapping of ExperimentID to featureFlags */ public static Map> generateExperimentFeatureMapping(List featureFlags) { Map> experimentFeatureMap = new HashMap<>(); diff --git a/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java b/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java index 57a4e5bec..b7bad0776 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java +++ b/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java @@ -45,7 +45,7 @@ public class AudienceIdCondition implements Condition { /** * Constructor used in json parsing to store the audienceId parsed from Experiment.audienceConditions. * - * @param audienceId + * @param audienceId The audience id */ @JsonCreator public AudienceIdCondition(String audienceId) { diff --git a/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java b/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java index a468bc5e2..1df33e125 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java +++ b/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java @@ -72,8 +72,8 @@ public static Match getMatch(String name) throws UnknownMatchTypeException { * register registers a Match implementation with it's name. * NOTE: This does not check for existence so default implementations can * be overridden. - * @param name - * @param match + * @param name The match name + * @param match The match implementation */ public static void register(String name, Match match) { registry.put(name, match); diff --git a/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java b/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java index d963e7702..ab9acbee1 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java +++ b/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java @@ -44,6 +44,11 @@ public SemanticVersion(String version) { /** * compare takes object inputs and coerces them into SemanticVersion objects before performing the comparison. * If the input values cannot be coerced then an {@link UnexpectedValueTypeException} is thrown. + * + * @param o1 The object to be compared + * @param o2 The object to be compared to + * @return The compare result + * @throws UnexpectedValueTypeException when an error is detected while comparing */ public static int compare(Object o1, Object o2) throws UnexpectedValueTypeException { if (o1 instanceof String && o2 instanceof String) { diff --git a/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java b/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java index c8fe74b08..723e6de3c 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java +++ b/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java @@ -33,14 +33,18 @@ public interface ConfigParser { /** - * @param json the json to parse - * @return generates a {@code ProjectConfig} configuration from the provided json + * @param json The json to parse + * @return The {@code ProjectConfig} configuration from the provided json * @throws ConfigParseException when there's an issue parsing the provided project config */ ProjectConfig parseProjectConfig(@Nonnull String json) throws ConfigParseException; /** * OptimizelyJSON parsing + * + * @param src The OptimizelyJSON + * @return The serialized String + * @throws JsonParseException when parsing JSON fails */ String toJson(Object src) throws JsonParseException; T fromJson(String json, Class clazz) throws JsonParseException; diff --git a/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java b/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java index f10c134b3..c4fbbb485 100644 --- a/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java +++ b/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java @@ -246,6 +246,9 @@ public static class Builder { /** * {@link EventHandler} implementation used to dispatch events to Optimizely. + * + * @param eventHandler The event handler + * @return The BatchEventProcessor builder */ public Builder withEventHandler(EventHandler eventHandler) { this.eventHandler = eventHandler; @@ -254,6 +257,9 @@ public Builder withEventHandler(EventHandler eventHandler) { /** * EventQueue is the underlying BlockingQueue used to buffer events before being added to the batch payload. + * + * @param eventQueue The event queue + * @return The BatchEventProcessor builder */ public Builder withEventQueue(BlockingQueue eventQueue) { this.eventQueue = eventQueue; @@ -262,6 +268,9 @@ public Builder withEventQueue(BlockingQueue eventQueue) { /** * BatchSize is the maximum number of events contained within a single event batch. + * + * @param batchSize The batch size + * @return The BatchEventProcessor builder */ public Builder withBatchSize(Integer batchSize) { this.batchSize = batchSize; @@ -271,6 +280,9 @@ public Builder withBatchSize(Integer batchSize) { /** * FlushInterval is the maximum duration, in milliseconds, that an event will remain in flight before * being flushed to the event dispatcher. + * + * @param flushInterval The flush interval + * @return The BatchEventProcessor builder */ public Builder withFlushInterval(Long flushInterval) { this.flushInterval = flushInterval; @@ -279,6 +291,9 @@ public Builder withFlushInterval(Long flushInterval) { /** * ExecutorService used to execute the {@link EventConsumer} thread. + * + * @param executor The ExecutorService + * @return The BatchEventProcessor builder */ public Builder withExecutor(ExecutorService executor) { this.executor = executor; @@ -287,6 +302,10 @@ public Builder withExecutor(ExecutorService executor) { /** * Timeout is the maximum time to wait for the EventProcessor to close. + * + * @param duration The max time to wait for the EventProcessor to close + * @param timeUnit The time unit + * @return The BatchEventProcessor builder */ public Builder withTimeout(long duration, TimeUnit timeUnit) { this.timeoutMillis = timeUnit.toMillis(duration); @@ -295,6 +314,9 @@ public Builder withTimeout(long duration, TimeUnit timeUnit) { /** * NotificationCenter used to notify when event batches are flushed. + * + * @param notificationCenter The NotificationCenter + * @return The BatchEventProcessor builder */ public Builder withNotificationCenter(NotificationCenter notificationCenter) { this.notificationCenter = notificationCenter; diff --git a/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java index 5e6e36339..e28aba2f3 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java @@ -122,7 +122,9 @@ static public Condition parseConditions(Class clazz, Object object) throw /** * parse conditions using List and Map * + * @param clazz the class of parsed condition * @param rawObjectList list of conditions + * @param This is the type parameter * @return audienceCondition */ static public Condition parseConditions(Class clazz, List rawObjectList) throws InvalidAudienceCondition { @@ -183,7 +185,9 @@ static public String operand(Object object) { /** * Parse conditions from org.json.JsonArray * + * @param clazz the class of parsed condition * @param conditionJson jsonArray to parse + * @param This is the type parameter * @return condition parsed from conditionJson. */ static public Condition parseConditions(Class clazz, org.json.JSONArray conditionJson) throws InvalidAudienceCondition { diff --git a/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java index 54d76fe53..7988b7783 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java @@ -29,8 +29,8 @@ public final class EventTagUtils { /** * Grab the revenue value from the event tags. "revenue" is a reserved keyword. * - * @param eventTags - * @return Long + * @param eventTags The event tags + * @return Long The revenue value */ public static Long getRevenueValue(@Nonnull Map eventTags) { Long eventValue = null; @@ -51,6 +51,9 @@ public static Long getRevenueValue(@Nonnull Map eventTags) { /** * Fetch the numeric metric value from event tags. "value" is a reserved keyword. + * + * @param eventTags The event tags + * @return The numeric metric value */ public static Double getNumericValue(@Nonnull Map eventTags) { Double eventValue = null; diff --git a/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java index 5fc66982a..d745a44c1 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java @@ -65,6 +65,7 @@ public final class PropertyUtils { /** * Clears a System property prepended with "optimizely.". + * @param key The configuration key */ public static void clear(String key) { System.clearProperty("optimizely." + key); @@ -72,6 +73,9 @@ public static void clear(String key) { /** * Sets a System property prepended with "optimizely.". + * + * @param key The configuration key + * @param value The String value */ public static void set(String key, String value) { System.setProperty("optimizely." + key, value); @@ -84,6 +88,9 @@ public static void set(String key, String value) { *
  • Environment variables - Key is prepended with "optimizely.", uppercased and "." are replaced with "_".
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @return The String value */ public static String get(String key) { return get(key, null); @@ -97,6 +104,10 @@ public static String get(String key) { *
  • Environment variables - Key is prepended with "optimizely.", upper cased and "."s are replaced with "_"s.
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @param dafault The default value + * @return The String value */ public static String get(String key, String dafault) { // Try to obtain from a Java System Property @@ -131,6 +142,9 @@ public static String get(String key, String dafault) { *
  • Environment variables - Key is prepended with "optimizely.", upper cased and "."s are replaced with "_"s.
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @return The integer value */ public static Long getLong(String key) { return getLong(key, null); @@ -144,6 +158,10 @@ public static Long getLong(String key) { *
  • Environment variables - Key is prepended with "optimizely.", upper cased and "."s are replaced with "_"s.
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @param dafault The default value + * @return The long value */ public static Long getLong(String key, Long dafault) { String value = get(key); @@ -168,7 +186,11 @@ public static Long getLong(String key, Long dafault) { *
  • Environment variables - Key is prepended with "optimizely.", upper cased and "."s are replaced with "_"s.
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @return The integer value */ + public static Integer getInteger(String key) { return getInteger(key, null); } @@ -181,7 +203,12 @@ public static Integer getInteger(String key) { *
  • Environment variables - Key is prepended with "optimizely.", upper cased and "."s are replaced with "_"s.
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @param dafault The default value + * @return The integer value */ + public static Integer getInteger(String key, Integer dafault) { String value = get(key); if (value == null) { @@ -204,6 +231,11 @@ public static Integer getInteger(String key, Integer dafault) { *
  • Environment variables - Key is prepended with "optimizely.", upper cased and "."s are replaced with "_"s.
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @param clazz The value class + * @param This is the type parameter + * @return The value */ public static T getEnum(String key, Class clazz) { return getEnum(key, clazz, null); @@ -217,6 +249,12 @@ public static T getEnum(String key, Class clazz) { *
  • Environment variables - Key is prepended with "optimizely.", upper cased and "."s are replaced with "_"s.
  • *
  • Optimizely Properties - Key is sourced as-is.
  • * + * + * @param key The configuration key + * @param clazz The value class + * @param dafault The default value + * @param This is the type parameter + * @return The value */ @SuppressWarnings("unchecked") public static T getEnum(String key, Class clazz, T dafault) { diff --git a/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java index 800fbde12..8febb6595 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java @@ -28,6 +28,8 @@ public class SafetyUtils { /** * Helper method which checks if Object is an instance of AutoCloseable and calls close() on it. + * + * @param obj The object */ public static void tryClose(Object obj) { if (!(obj instanceof AutoCloseable)) { diff --git a/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java b/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java index 8bb273425..667c791a7 100644 --- a/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java +++ b/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java @@ -78,6 +78,8 @@ public Variation getVariation() { * This interface is deprecated since this is no longer a one-to-one mapping. * Please use a {@link NotificationHandler} explicitly for LogEvent messages. * {@link com.optimizely.ab.Optimizely#addLogEventNotificationHandler(NotificationHandler)} + * + * @return The event */ @Deprecated public LogEvent getEvent() { diff --git a/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java b/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java index 499f8ec43..858cd9b32 100644 --- a/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java +++ b/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java @@ -122,7 +122,7 @@ public int addNotificationHandler(Class clazz, NotificationHandler han /** * Convenience method to support lambdas as callbacks in later version of Java (8+). * - * @param activateNotificationListener + * @param activateNotificationListener The ActivateNotificationListener * @return greater than zero if added. * * @deprecated by {@link NotificationManager#addHandler(NotificationHandler)} @@ -151,7 +151,7 @@ public int addActivateNotificationListener(final ActivateNotificationListenerInt /** * Convenience method to support lambdas as callbacks in later versions of Java (8+) * - * @param trackNotificationListener + * @param trackNotificationListener The TrackNotificationListener * @return greater than zero if added. * * @deprecated by {@link NotificationManager#addHandler(NotificationHandler)} @@ -255,6 +255,8 @@ public void clearNotificationListeners(NotificationType notificationType) { /** * Clear notification listeners by notification class. + * + * @param clazz The NotificationLister class */ public void clearNotificationListeners(Class clazz) { NotificationManager notificationManager = getNotificationManager(clazz); diff --git a/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java b/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java index 540dfa277..0576f2e89 100644 --- a/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java +++ b/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java @@ -72,6 +72,8 @@ public String getUserId() { * This interface is deprecated since this is no longer a one-to-one mapping. * Please use a {@link NotificationHandler} explicitly for LogEvent messages. * {@link com.optimizely.ab.Optimizely#addLogEventNotificationHandler(NotificationHandler)} + * + * @return The event */ @Deprecated public LogEvent getEvent() { diff --git a/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java b/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java index 97bff838c..45fe035b4 100644 --- a/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java +++ b/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java @@ -73,6 +73,8 @@ public String toString() { /** * Returns the {@code Map} representation of json data + * + * @return The {@code Map} representation of json data */ @Nullable public Map toMap() { @@ -100,7 +102,9 @@ public Map toMap() { * * @param jsonKey The JSON key paths for the data to access * @param clazz The user-defined class that the json data will be parsed to + * @param This is the type parameter * @return an instance of clazz type with the parsed data filled in (or null if parse fails) + * @throws JsonParseException when a JSON parser is not available. */ @Nullable public T getValue(@Nullable String jsonKey, Class clazz) throws JsonParseException { diff --git a/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java b/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java index fa4a83dc4..26f155eda 100644 --- a/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java +++ b/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java @@ -52,6 +52,8 @@ public final class OptimizelyFactory { /** * Convenience method for setting the maximum number of events contained within a batch. * {@link AsyncEventHandler} + * + * @param batchSize The max number of events for batching */ public static void setMaxEventBatchSize(int batchSize) { if (batchSize <= 0) { @@ -65,6 +67,8 @@ public static void setMaxEventBatchSize(int batchSize) { /** * Convenience method for setting the maximum time interval in milliseconds between event dispatches. * {@link AsyncEventHandler} + * + * @param batchInterval The max time interval for event batching */ public static void setMaxEventBatchInterval(long batchInterval) { if (batchInterval <= 0) { @@ -78,6 +82,9 @@ public static void setMaxEventBatchInterval(long batchInterval) { /** * Convenience method for setting the required queueing parameters for event dispatching. * {@link AsyncEventHandler} + * + * @param queueCapacity A depth of the event queue + * @param numberWorkers The number of workers */ public static void setEventQueueParams(int queueCapacity, int numberWorkers) { if (queueCapacity <= 0) { @@ -97,6 +104,9 @@ public static void setEventQueueParams(int queueCapacity, int numberWorkers) { /** * Convenience method for setting the blocking timeout. * {@link HttpProjectConfigManager.Builder#withBlockingTimeout(Long, TimeUnit)} + * + * @param blockingDuration The blocking time duration + * @param blockingTimeout The blocking time unit */ public static void setBlockingTimeout(long blockingDuration, TimeUnit blockingTimeout) { if (blockingTimeout == null) { @@ -116,6 +126,9 @@ public static void setBlockingTimeout(long blockingDuration, TimeUnit blockingTi /** * Convenience method for setting the polling interval on System properties. * {@link HttpProjectConfigManager.Builder#withPollingInterval(Long, TimeUnit)} + * + * @param pollingDuration The polling interval + * @param pollingTimeout The polling time unit */ public static void setPollingInterval(long pollingDuration, TimeUnit pollingTimeout) { if (pollingTimeout == null) { @@ -135,6 +148,8 @@ public static void setPollingInterval(long pollingDuration, TimeUnit pollingTime /** * Convenience method for setting the sdk key on System properties. * {@link HttpProjectConfigManager.Builder#withSdkKey(String)} + * + * @param sdkKey The sdk key */ public static void setSdkKey(String sdkKey) { if (sdkKey == null) { @@ -148,6 +163,8 @@ public static void setSdkKey(String sdkKey) { /** * Convenience method for setting the Datafile Access Token on System properties. * {@link HttpProjectConfigManager.Builder#withDatafileAccessToken(String)} + * + * @param datafileAccessToken The datafile access token */ public static void setDatafileAccessToken(String datafileAccessToken) { if (datafileAccessToken == null) { @@ -160,8 +177,8 @@ public static void setDatafileAccessToken(String datafileAccessToken) { /** * Returns a new Optimizely instance based on preset configuration. - * EventHandler - {@link AsyncEventHandler} - * ProjectConfigManager - {@link HttpProjectConfigManager} + * + * @return A new Optimizely instance */ public static Optimizely newDefaultInstance() { String sdkKey = PropertyUtils.get(HttpProjectConfigManager.CONFIG_SDK_KEY); @@ -174,6 +191,7 @@ public static Optimizely newDefaultInstance() { * ProjectConfigManager - {@link HttpProjectConfigManager} * * @param sdkKey SDK key used to build the ProjectConfigManager. + * @return A new Optimizely instance */ public static Optimizely newDefaultInstance(String sdkKey) { if (sdkKey == null) { @@ -191,6 +209,7 @@ public static Optimizely newDefaultInstance(String sdkKey) { * * @param sdkKey SDK key used to build the ProjectConfigManager. * @param fallback Fallback datafile string used by the ProjectConfigManager to be immediately available. + * @return A new Optimizely instance */ public static Optimizely newDefaultInstance(String sdkKey, String fallback) { String datafileAccessToken = PropertyUtils.get(HttpProjectConfigManager.CONFIG_DATAFILE_AUTH_TOKEN); @@ -203,6 +222,7 @@ public static Optimizely newDefaultInstance(String sdkKey, String fallback) { * @param sdkKey SDK key used to build the ProjectConfigManager. * @param fallback Fallback datafile string used by the ProjectConfigManager to be immediately available. * @param datafileAccessToken Token for authenticated datafile access. + * @return A new Optimizely instance */ public static Optimizely newDefaultInstance(String sdkKey, String fallback, String datafileAccessToken) { NotificationCenter notificationCenter = new NotificationCenter(); @@ -224,6 +244,7 @@ public static Optimizely newDefaultInstance(String sdkKey, String fallback, Stri * EventHandler - {@link AsyncEventHandler} * * @param configManager The {@link ProjectConfigManager} supplied to Optimizely instance. + * @return A new Optimizely instance */ public static Optimizely newDefaultInstance(ProjectConfigManager configManager) { return newDefaultInstance(configManager, null); @@ -235,6 +256,7 @@ public static Optimizely newDefaultInstance(ProjectConfigManager configManager) * * @param configManager The {@link ProjectConfigManager} supplied to Optimizely instance. * @param notificationCenter The {@link NotificationCenter} supplied to Optimizely instance. + * @return A new Optimizely instance */ public static Optimizely newDefaultInstance(ProjectConfigManager configManager, NotificationCenter notificationCenter) { EventHandler eventHandler = AsyncEventHandler.builder().build(); @@ -247,7 +269,8 @@ public static Optimizely newDefaultInstance(ProjectConfigManager configManager, * @param configManager The {@link ProjectConfigManager} supplied to Optimizely instance. * @param notificationCenter The {@link ProjectConfigManager} supplied to Optimizely instance. * @param eventHandler The {@link EventHandler} supplied to Optimizely instance. - */ + * @return A new Optimizely instance + * */ public static Optimizely newDefaultInstance(ProjectConfigManager configManager, NotificationCenter notificationCenter, EventHandler eventHandler) { if (notificationCenter == null) { notificationCenter = new NotificationCenter(); diff --git a/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java b/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java index eb43e67a5..6c72f2a57 100644 --- a/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java +++ b/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java @@ -22,6 +22,7 @@ import com.optimizely.ab.config.parser.ConfigParseException; import com.optimizely.ab.internal.PropertyUtils; import com.optimizely.ab.notification.NotificationCenter; +import com.optimizely.ab.optimizelyconfig.OptimizelyConfig; import org.apache.http.*; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; @@ -212,6 +213,10 @@ public Builder withOptimizelyHttpClient(OptimizelyHttpClient httpClient) { * to {@link PollingProjectConfigManager#getConfig()}. If the timeout is exceeded then the * PollingProjectConfigManager will begin returning null immediately until the call to Poll * succeeds. + * + * @param period A timeout period + * @param timeUnit A timeout unit + * @return A HttpProjectConfigManager builder */ public Builder withBlockingTimeout(Long period, TimeUnit timeUnit) { if (timeUnit == null) { @@ -265,6 +270,8 @@ public Builder withNotificationCenter(NotificationCenter notificationCenter) { /** * HttpProjectConfigManager.Builder that builds and starts a HttpProjectConfigManager. * This is the default builder which will block until a config is available. + * + * @return {@link HttpProjectConfigManager} */ public HttpProjectConfigManager build() { return build(false); @@ -275,6 +282,7 @@ public HttpProjectConfigManager build() { * * @param defer When true, we will not wait for the configuration to be available * before returning the HttpProjectConfigManager instance. + * @return {@link HttpProjectConfigManager} */ public HttpProjectConfigManager build(boolean defer) { if (period <= 0) { diff --git a/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java b/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java index 5108187ef..5ad625237 100644 --- a/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java +++ b/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java @@ -73,6 +73,9 @@ public class AsyncEventHandler implements EventHandler, AutoCloseable { /** * @deprecated Use the builder {@link Builder} + * + * @param queueCapacity A depth of the event queue + * @param numWorkers The number of workers */ @Deprecated public AsyncEventHandler(int queueCapacity, @@ -82,6 +85,12 @@ public AsyncEventHandler(int queueCapacity, /** * @deprecated Use the builder {@link Builder} + * + * @param queueCapacity A depth of the event queue + * @param numWorkers The number of workers + * @param maxConnections The max number of concurrent connections + * @param connectionsPerRoute The max number of concurrent connections per route + * @param validateAfter An inactivity period in milliseconds after which persistent connections must be re-validated prior to being leased to the consumer. */ @Deprecated public AsyncEventHandler(int queueCapacity, From 15857bc54182d2e3f41909ff06cb8e6930be31de Mon Sep 17 00:00:00 2001 From: Jae Kim Date: Mon, 1 Mar 2021 16:37:38 -0800 Subject: [PATCH 2/2] fix copyright years --- .../java/com/optimizely/ab/config/DatafileProjectConfig.java | 2 +- .../main/java/com/optimizely/ab/config/ProjectConfigUtils.java | 2 +- .../com/optimizely/ab/config/audience/AudienceIdCondition.java | 2 +- .../com/optimizely/ab/config/audience/match/MatchRegistry.java | 2 +- .../optimizely/ab/config/audience/match/SemanticVersion.java | 2 +- .../main/java/com/optimizely/ab/config/parser/ConfigParser.java | 2 +- .../main/java/com/optimizely/ab/event/BatchEventProcessor.java | 2 +- .../main/java/com/optimizely/ab/internal/ConditionUtils.java | 2 +- .../src/main/java/com/optimizely/ab/internal/EventTagUtils.java | 2 +- .../src/main/java/com/optimizely/ab/internal/PropertyUtils.java | 2 +- .../src/main/java/com/optimizely/ab/internal/SafetyUtils.java | 2 +- .../com/optimizely/ab/notification/ActivateNotification.java | 2 +- .../java/com/optimizely/ab/notification/NotificationCenter.java | 2 +- .../java/com/optimizely/ab/notification/TrackNotification.java | 2 +- .../java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java | 2 +- .../src/main/java/com/optimizely/ab/OptimizelyFactory.java | 2 +- .../java/com/optimizely/ab/config/HttpProjectConfigManager.java | 2 +- .../main/java/com/optimizely/ab/event/AsyncEventHandler.java | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java b/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java index fa8f1b56b..2bc377a29 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java +++ b/core-api/src/main/java/com/optimizely/ab/config/DatafileProjectConfig.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016-2020, Optimizely and contributors + * Copyright 2016-2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java b/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java index 6aa4f05a3..060f82a06 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/config/ProjectConfigUtils.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016-2017, 2019, Optimizely and contributors + * Copyright 2016-2017,2019,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java b/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java index b7bad0776..c4f052ebb 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java +++ b/core-api/src/main/java/com/optimizely/ab/config/audience/AudienceIdCondition.java @@ -1,6 +1,6 @@ /** * - * Copyright 2018-2020, Optimizely and contributors + * Copyright 2018-2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java b/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java index 1df33e125..f78c35c8d 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java +++ b/core-api/src/main/java/com/optimizely/ab/config/audience/match/MatchRegistry.java @@ -1,6 +1,6 @@ /** * - * Copyright 2020, Optimizely and contributors + * Copyright 2020-2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java b/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java index ab9acbee1..22fd56c4a 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java +++ b/core-api/src/main/java/com/optimizely/ab/config/audience/match/SemanticVersion.java @@ -1,6 +1,6 @@ /** * - * Copyright 2020, Optimizely and contributors + * Copyright 2020-2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java b/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java index 723e6de3c..966478cff 100644 --- a/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java +++ b/core-api/src/main/java/com/optimizely/ab/config/parser/ConfigParser.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016-2017, Optimizely and contributors + * Copyright 2016-2017,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java b/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java index c4fbbb485..daf81d71a 100644 --- a/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java +++ b/core-api/src/main/java/com/optimizely/ab/event/BatchEventProcessor.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019, Optimizely and contributors + * Copyright 2019,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java index e28aba2f3..d9af5b58b 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/ConditionUtils.java @@ -1,6 +1,6 @@ /** * - * Copyright 2018-2019, Optimizely and contributors + * Copyright 2018-2019,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java index 7988b7783..76b6b9ae3 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/EventTagUtils.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016-2019, Optimizely and contributors + * Copyright 2016-2019,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java index d745a44c1..4ef03b2cc 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/PropertyUtils.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019, Optimizely + * Copyright 2019,2021, Optimizely * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java b/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java index 8febb6595..eaed2e9d5 100644 --- a/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java +++ b/core-api/src/main/java/com/optimizely/ab/internal/SafetyUtils.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019, Optimizely + * Copyright 2019,2021, Optimizely * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java b/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java index 667c791a7..dc70079de 100644 --- a/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java +++ b/core-api/src/main/java/com/optimizely/ab/notification/ActivateNotification.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019, Optimizely and contributors + * Copyright 2019,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java b/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java index 858cd9b32..df8a7afbb 100644 --- a/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java +++ b/core-api/src/main/java/com/optimizely/ab/notification/NotificationCenter.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017-2020, Optimizely and contributors + * Copyright 2017-2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java b/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java index 0576f2e89..4651d5bbb 100644 --- a/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java +++ b/core-api/src/main/java/com/optimizely/ab/notification/TrackNotification.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019, Optimizely and contributors + * Copyright 2019,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java b/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java index 45fe035b4..4cb835958 100644 --- a/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java +++ b/core-api/src/main/java/com/optimizely/ab/optimizelyjson/OptimizelyJSON.java @@ -1,6 +1,6 @@ /** * - * Copyright 2020, Optimizely and contributors + * Copyright 2020-2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java b/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java index 26f155eda..2ba52d6e4 100644 --- a/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java +++ b/core-httpclient-impl/src/main/java/com/optimizely/ab/OptimizelyFactory.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019-2020, Optimizely + * Copyright 2019-2021, Optimizely * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java b/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java index 6c72f2a57..c771da9fa 100644 --- a/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java +++ b/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java @@ -1,6 +1,6 @@ /** * - * Copyright 2019, Optimizely + * Copyright 2019,2021, Optimizely * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java b/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java index 5ad625237..3d32f3971 100644 --- a/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java +++ b/core-httpclient-impl/src/main/java/com/optimizely/ab/event/AsyncEventHandler.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016-2019, Optimizely and contributors + * Copyright 2016-2019,2021, Optimizely and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.