-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCountLines.java
More file actions
53 lines (46 loc) · 1.32 KB
/
CountLines.java
File metadata and controls
53 lines (46 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.
package oql.actions;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.systemwideinterfaces.core.UserAction;
public class CountLines extends UserAction<java.lang.Long>
{
private final java.lang.String InputString;
public CountLines(
IContext context,
java.lang.String _inputString
)
{
super(context);
this.InputString = _inputString;
}
@java.lang.Override
public java.lang.Long executeAction() throws Exception
{
// BEGIN USER CODE
if (InputString == null) {
return 0L;
}
return InputString.lines()
.filter(line -> !line.trim().isEmpty())
.count();
// END USER CODE
}
/**
* Returns a string representation of this action
* @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "CountLines";
}
// BEGIN EXTRA CODE
// END EXTRA CODE
}