Skip to content

Commit

Permalink
Android: #553: Temporary disable HTML validation in Javadoc
Browse files Browse the repository at this point in the history
- Fixed several Javadoc warnings with added documentation.
  • Loading branch information
hvge committed Sep 21, 2023
1 parent ae7259b commit 2c30a39
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,35 @@
*/
public class KVHelper<K> {

public @NonNull Map<K, Object> map;
/**
* Map to use in the helper.
*/
public final @NonNull Map<K, Object> map;

/**
* Construct helper with given map.
* @param map Map to use in the helper.
*/
public KVHelper(Map<K, Object> map) {
this.map = map != null ? map : Collections.emptyMap();
}

/**
* Get a string value for given key.
* @param key Key to retrieve the string value.
* @return String for given key or null if no such item is stored in the map.
*/
@Nullable
public String valueAsString(@NonNull K key) {
final Object v = map.get(key);
return v instanceof String ? (String) v : null;
}

/**
* Get a multiline string value for given key. The returned string doesn't contain CR-LF endings.
* @param key Key to retrieve the string value.
* @return Multiline string for given key or null if no such item is stored in the map.
*/
@Nullable
public String valueAsMultilineString(@NonNull K key) {
final String s = valueAsString(key);
Expand All @@ -55,18 +72,33 @@ public String valueAsMultilineString(@NonNull K key) {
return s;
}

/**
* Get a boolean value for given key.
* @param key Key to retrieve the boolean value.
* @return Boolean for given key or false if no such item is stored in the map.
*/
public boolean valueAsBool(@NonNull K key) {
final Object v = map.get(key);
return v instanceof Boolean ? (Boolean) v : false;
}

/**
* Get a map for given key.
* @param key Key to retrieve the map.
* @return Map for given key or false if no such item is stored.
*/
@SuppressWarnings("unchecked")
@Nullable
public Map<K, Object> valueAsMap(@NonNull K key) {
final Object v = map.get(key);
return v instanceof Map ? (Map<K, Object>) v : null;
}

/**
* Get a Date created from timestamp in seconds, stored for the given key.
* @param key Key to retrieve the timestamp.
* @return Date created from value for given key or null if no such item is stored in the map.
*/
@Nullable
public Date valueAsTimestamp(@NonNull K key) {
final Object v = map.get(key);
Expand All @@ -76,6 +108,12 @@ public Date valueAsTimestamp(@NonNull K key) {
return null;
}

/**
* Get a Date created from string value stored for the given key.
* @param key Key to retrieve the date.
* @param format Format of date.
* @return Date created from value for given key, or null if no such item is stored in the map.
*/
@Nullable
public Date valueAsDate(@NonNull K key, @NonNull String format) {
final String v = valueAsString(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,20 @@
@StringDef({ADD_BIOMETRY, FETCH_ENCRYPTION_KEY, SIGN_WITH_DEVICE_PRIVATE_KEY, RECOVERY_CODE})
public @interface VaultUnlockReason {

/**
* Add biometry factor is the reason for vault unlock.
*/
String ADD_BIOMETRY = "ADD_BIOMETRY";
/**
* Fetch encryption key is the reason for vault unlock.
*/
String FETCH_ENCRYPTION_KEY = "FETCH_ENCRYPTION_KEY";
/**
* Sign with device private key is the reason for vault unlock.
*/
String SIGN_WITH_DEVICE_PRIVATE_KEY = "SIGN_WITH_DEVICE_PRIVATE_KEY";
/**
* Get recovery code is the reason for vault unlock.
*/
String RECOVERY_CODE = "RECOVERY_CODE";
}
4 changes: 4 additions & 0 deletions proj-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ allprojects {
mavenCentral()
google()
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:-html', '-quiet')
}
}

0 comments on commit 2c30a39

Please sign in to comment.