Skip to content

Commit 6572488

Browse files
committed
Java docs for v1_6 models, done.
1 parent 96826cf commit 6572488

File tree

121 files changed

+1675
-491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1675
-491
lines changed

ocpp-common/src/main/java/eu/chargetime/ocpp/Client.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,21 @@ public Confirmation handleRequest(Request request) {
102102
Feature feature = findFeatureByRequest(request);
103103
return feature.handleRequest(request);
104104
}
105+
106+
@Override
107+
public void handleError(String uniqueId) {
108+
109+
}
110+
111+
@Override
112+
public void handleConnectionClosed() {
113+
114+
}
115+
116+
@Override
117+
public void handleConnectionOpened() {
118+
119+
}
105120
});
106121
}
107122

ocpp-common/src/main/java/eu/chargetime/ocpp/SessionEvents.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public interface SessionEvents {
4040
* If null is returned, a "NotImplemented" error will be send.
4141
*
4242
* @param action action name of the {@link Feature}
43-
* @return {@Link Feature} found.
43+
* @return {@link Feature} found.
4444
*/
4545
Feature findFeatureByAction(String action);
4646

ocpp-common/src/main/java/eu/chargetime/ocpp/model/Message.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package eu.chargetime.ocpp.model;
22

3-
/**
3+
/*
44
ChargeTime.eu - Java-OCA-OCPP
55
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
66
@@ -26,22 +26,46 @@ of this software and associated documentation files (the "Software"), to deal
2626
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2727
SOFTWARE.
2828
*/
29+
30+
/**
31+
* Wrapper class for a message
32+
*/
2933
public class Message {
3034
private String id;
3135
private String payload;
3236

37+
/**
38+
* Get unique id for message.
39+
*
40+
* @return message id.
41+
*/
3342
public String getId() {
3443
return id;
3544
}
3645

46+
/**
47+
* Set unique id for message.
48+
*
49+
* @param id String, message id.
50+
*/
3751
public void setId(String id) {
3852
this.id = id;
3953
}
4054

55+
/**
56+
* Get attached payload.
57+
*
58+
* @return payload.
59+
*/
4160
public String getPayload() {
4261
return payload;
4362
}
4463

64+
/**
65+
* Attach payload to message.
66+
*
67+
* @param payload String, payload.
68+
*/
4569
public void setPayload(String payload) {
4670
this.payload = payload;
4771
}

ocpp-common/src/main/java/eu/chargetime/ocpp/utilities/ModelUtil.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package eu.chargetime.ocpp.utilities;
22

3-
/**
3+
/*
44
ChargeTime.eu - Java OCA OCPP
55
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
66
@@ -26,8 +26,19 @@ of this software and associated documentation files (the "Software"), to deal
2626
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2727
SOFTWARE.
2828
*/
29+
30+
/**
31+
* Utilities for model classes. Used to validate values.
32+
*/
2933
public abstract class ModelUtil {
3034

35+
/**
36+
* Check if a value is in a list of values.
37+
*
38+
* @param needle value we want to search for.
39+
* @param hayStack list of value that we search in.
40+
* @return true if value was found in list.
41+
*/
3142
public static boolean isAmong(Object needle, Object... hayStack) {
3243
boolean found = false;
3344
if (hayStack != null) {
@@ -40,6 +51,12 @@ public static boolean isAmong(Object needle, Object... hayStack) {
4051
return found;
4152
}
4253

54+
/**
55+
* Compares two values.
56+
* @param object1 Right value to compare.
57+
* @param object2 Left value to compare.
58+
* @return Both values are null or equal.
59+
*/
4360
private static boolean isNullOrEqual(Object object1, Object object2) {
4461
boolean nullOrEqual = false;
4562
if (object1 == null && object2 == null) {
@@ -50,6 +67,13 @@ private static boolean isNullOrEqual(Object object1, Object object2) {
5067
return nullOrEqual;
5168
}
5269

70+
/**
71+
* Check if a string exceeds a given length.
72+
*
73+
* @param input The string to check.
74+
* @param maxLength The largest length accepted.
75+
* @return The string length does not exceed max length.
76+
*/
5377
public static boolean validate(String input, int maxLength) {
5478
return input != null && input.length() <= maxLength;
5579
}

ocpp-common/src/main/java/eu/chargetime/ocpp/utilities/TestUtilities.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package eu.chargetime.ocpp.utilities;
22

3-
/**
3+
/*
44
* ChargeTime.eu - Java-OCA-OCPP
55
*
66
* MIT License
@@ -25,8 +25,18 @@
2525
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2626
* SOFTWARE.
2727
*/
28+
29+
/**
30+
* Utilities for tests. Used to quickly create usefull objects.
31+
*/
2832
public class TestUtilities {
2933

34+
/**
35+
* Create a string of a given length.
36+
*
37+
* @param length the desired length.
38+
* @return A string of the desired length.
39+
*/
3040
protected String aString(int length) {
3141
String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus bibendum eros vitae sapien metusa.";
3242

@@ -41,10 +51,24 @@ protected String aString(int length) {
4151
return lorem.substring(0, length);
4252
}
4353

54+
/**
55+
* Create an array of elements.
56+
*
57+
* @param objects Params of elements to add to the list.
58+
* @param <T> The type of the elements.
59+
* @return An array of the given elements.
60+
*/
4461
protected <T> T[] aList(T... objects) {
4562
return objects;
4663
}
4764

65+
/**
66+
* Create a String from an Array.
67+
*
68+
* @param delimiter Used to split the values.
69+
* @param array The array to print.
70+
* @return Formatted string, with array values.
71+
*/
4872
protected String join(String delimiter, Object[] array) {
4973
StringBuilder output = new StringBuilder();
5074

ocpp-common/src/test/java/eu/chargetime/ocpp/test/ClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import static org.junit.Assert.assertThat;
2121
import static org.mockito.Mockito.*;
2222

23-
/**
23+
/*
2424
ChargeTime.eu - Java-OCA-OCPP
2525
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
2626

ocpp-common/src/test/java/eu/chargetime/ocpp/test/QueueTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import static org.hamcrest.MatcherAssert.assertThat;
1010
import static org.mockito.Mockito.mock;
1111

12-
/**
12+
/*
1313
ChargeTime.eu - Java-OCA-OCPP
1414
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
1515

ocpp-common/src/test/java/eu/chargetime/ocpp/test/SessionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import static org.junit.Assert.assertThat;
1414
import static org.mockito.Mockito.*;
1515

16-
/**
16+
/*
1717
ChargeTime.eu - Java-OCA-OCPP
1818
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
1919

ocpp-common/src/test/java/eu/chargetime/ocpp/utilities/test/ModelUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import static org.hamcrest.CoreMatchers.is;
77
import static org.junit.Assert.assertThat;
88

9-
/**
9+
/*
1010
ChargeTime.eu - Java OCA OCPP
1111
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
1212

ocpp-v1_6-example/src/main/core_features/JSONClientSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import eu.chargetime.ocpp.feature.profile.CoreProfile;
77
import eu.chargetime.ocpp.model.*;
88

9-
/**
9+
/*
1010
* ChargeTime.eu - Java-OCA-OCPP
1111
* Copyright (C) 2015-2016 Thomas Volden <[email protected]>
1212
*

0 commit comments

Comments
 (0)