Skip to content
This repository was archived by the owner on Aug 23, 2020. It is now read-only.

Commit 91d8f7c

Browse files
legacycodeGalRogozinski
authored andcommitted
Documentation: Fixed and added javadoc comments for existing classes (#1026)
* added documentation * added documentation * Fixed mvn javadoc:javadoc errors, warnings and added missing documentation. * implemented review comments * removed unused import
1 parent 0365b8f commit 91d8f7c

File tree

8 files changed

+64
-19
lines changed

8 files changed

+64
-19
lines changed

src/main/java/com/iota/iri/IRI.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public static void main(String[] args) throws Exception {
6060
IRILauncher.main(args);
6161
}
6262

63+
/**
64+
* Reads the logging configuration file and logging level from system properties. You can set this values as
65+
* arguments to the Java VM by passing <code>-Dlogback.configurationFile=/path/to/config.xml -Dlogging-level=DEBUG</code>
66+
* to the Java VM. If no system properties are specified the logback default values and logging-level INFO will
67+
* be used.
68+
*/
6369
private static void configureLogging() {
6470
String config = System.getProperty("logback.configurationFile");
6571
String level = System.getProperty("logging-level", "").toUpperCase();
@@ -178,6 +184,14 @@ private static IotaConfig createConfiguration(String[] args) {
178184
return iotaConfig;
179185
}
180186

187+
/**
188+
* Parses the command line arguments for a config file that can be provided by parameter <code>-c</code>
189+
* or parameter <code>--config</code>. If no filename was provided we fall back to <code>iota.ini</code> file.
190+
* If no <code>iota.ini</code> file can be found return null.
191+
*
192+
* @param args command line arguments passed to main method.
193+
* @return File the chosen file to use as config, or null.
194+
*/
181195
private static File chooseConfigFile(String[] args) {
182196
int index = Math.max(ArrayUtils.indexOf(args, "-c"), ArrayUtils.indexOf(args, "--config"));
183197
if (index != -1) {

src/main/java/com/iota/iri/conf/ConfigFactory.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@
1313
import java.io.IOException;
1414
import java.util.Properties;
1515

16+
/**
17+
* Creates the global {@link IotaConfig} object with iri specific settings.
18+
*/
1619
public class ConfigFactory {
1720

21+
/**
22+
* Creates the {@link IotaConfig} object for {@link TestnetConfig} or {@link MainnetConfig}.
23+
*
24+
* @param isTestnet true if {@link TestnetConfig} should be created.
25+
* @return return the {@link IotaConfig} configuration.
26+
*/
1827
public static IotaConfig createIotaConfig(boolean isTestnet) {
1928
IotaConfig iotaConfig;
2029
if (isTestnet) {
@@ -26,8 +35,18 @@ public static IotaConfig createIotaConfig(boolean isTestnet) {
2635
return iotaConfig;
2736
}
2837

29-
public static IotaConfig createFromFile(File configFile, boolean testnet) throws IOException,
30-
IllegalArgumentException {
38+
/**
39+
* Creates the {@link IotaConfig} object for {@link TestnetConfig} or {@link MainnetConfig} from config file. Parse
40+
* the config file for <code>TESTNET=true</code>. If <code>TESTNET=true</code> is found we creates the
41+
* {@link TestnetConfig} object, else creates the {@link MainnetConfig}.
42+
*
43+
* @param configFile A property file with configuration options.
44+
* @param testnet When true a {@link TestnetConfig} is created.
45+
* @return the {@link IotaConfig} configuration.
46+
*
47+
* @throws IOException When config file could not be found.
48+
*/
49+
public static IotaConfig createFromFile(File configFile, boolean testnet) throws IOException {
3150
IotaConfig iotaConfig;
3251

3352
try (FileInputStream confStream = new FileInputStream(configFile)) {

src/main/java/com/iota/iri/conf/SnapshotConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public interface SnapshotConfig extends Config {
4141
long getSnapshotTime();
4242

4343
/**
44-
* return {@value Descriptions#SNAPSHOT_FILE}
44+
* @return {@value Descriptions#SNAPSHOT_FILE}
4545
*/
4646
String getSnapshotFile();
4747

src/main/java/com/iota/iri/service/API.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ private synchronized AbstractResponse getTipsStatement() throws Exception {
839839
* These trytes are returned by <tt>attachToTangle</tt>, or by doing proof of work somewhere else.
840840
*
841841
* @param trytes Transaction data to be stored.
842-
* @throws Exception When storing or updating a transaction fails
842+
* @throws Exception When storing or updating a transaction fails.
843843
**/
844844
public void storeTransactionsStatement(List<String> trytes) throws Exception {
845845
final List<TransactionViewModel> elements = new LinkedList<>();

src/main/java/com/iota/iri/service/ValidationException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public ValidationException() {
1111

1212
/**
1313
* Initializes a new instance of the ValidationException with the specified detail message.
14+
* @param msg message shown in exception details.
1415
*/
1516
public ValidationException(String msg) {
1617
super(msg);

src/main/java/com/iota/iri/service/dto/GetNeighborsResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class GetNeighborsResponse extends AbstractResponse {
3030
private Neighbor[] neighbors;
3131

3232
/**
33-
*
33+
* @see com.iota.iri.service.dto.GetNeighborsResponse.Neighbor
3434
* @return {@link #neighbors}
3535
*/
3636
public Neighbor[] getNeighbors() {

src/main/java/com/iota/iri/storage/PersistenceProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public interface PersistenceProvider {
4444

4545
/**
4646
* Atomically delete all {@code models}.
47-
* @param models key value pairs that to be expunged from the db
48-
* @throws Exception
47+
* @param models key value pairs that to be expunged from the db.
48+
* @throws Exception if data could not be expunged from the db.
4949
*/
5050
void deleteBatch(Collection<Pair<Indexable, ? extends Class<? extends Persistable>>> models) throws Exception;
5151

src/main/java/com/iota/iri/utils/collections/interfaces/UnIterableMap.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import java.util.Collection;
44
import java.util.Map;
55

6-
76
/**
87
* Similar to {@link Map} but hides key retrieval functionality.
98
* Thus one can't iterate over key or entries.
@@ -14,50 +13,62 @@
1413
*/
1514
public interface UnIterableMap<K,V> {
1615

17-
1816
/**
19-
* {See {@link Map#size()}}
17+
* @see Map#size()
18+
* @return {@link Map#size()}
2019
*/
2120
int size();
2221

2322
/**
24-
* {See {@link Map#isEmpty()}}
23+
* @see Map#isEmpty()
24+
* @return {@link Map#isEmpty()}
2525
*/
2626
boolean isEmpty();
2727

2828
/**
29-
* {See {@link Map#containsKey(Object)}}
29+
* @see Map#containsKey(Object)
30+
* @param key {@link Map#containsKey(Object)}
31+
* @return {@link Map#containsKey(Object)}
3032
*/
3133
boolean containsKey(K key);
3234

3335
/**
34-
* {See {@link Map#containsValue(Object)}}
36+
* @see Map#containsValue(Object)
37+
* @param value {@link Map#containsValue(Object)}
38+
* @return {@link Map#containsValue(Object)}
3539
*/
3640
boolean containsValue(V value);
3741

3842
/**
39-
*
40-
* {See {@link Map#get}}
43+
* @see Map#get(Object)
44+
* @param key {@link Map#get(Object)}
45+
* @return {@link Map#get(Object)}
4146
*/
4247
V get(K key);
4348

4449
/**
45-
* {See {@link Map#put}
50+
* @see Map#put(Object, Object)
51+
* @param key {@link Map#put(Object, Object)}
52+
* @param value {@link Map#put(Object, Object)}
53+
* @return {@link Map#put(Object, Object)}
4654
*/
4755
V put(K key, V value);
4856

4957
/**
50-
* {See {@link Map#keySet()}}
58+
* @see Map#remove(Object)
59+
* @param key {@link Map#remove(Object)}
60+
* @return {@link Map#remove(Object)}
5161
*/
5262
V remove(K key);
5363

5464
/**
55-
* {See {@link Map#clear()}}
65+
* @see Map#clear()
5666
*/
5767
void clear();
5868

5969
/**
60-
* {See {@link Map#values}
70+
* @see Map#values()
71+
* @return {@link Map#values()}
6172
*/
6273
Collection<V> values();
6374
}

0 commit comments

Comments
 (0)