Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing squid:ClassVariableVisibilityCheck: Class variable fields should not have public access #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public AvgCount(int total, int num) {
total_ = total;
num_ = num;
}
public int total_;
public int num_;
private int total_;
private int num_;
public float avg() {
return total_ / (float) num_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,25 @@ public AvgCount merge(Iterable<Integer> input) {
}
return this;
}
public Integer total_;
public Integer num_;
private Integer total_;
private Integer num_;

public Integer getTotal_() {
return total_;
}

public void setTotal_(Integer total_) {
this.total_ = total_;
}

public Integer getNum_() {
return num_;
}

public void setNum_(Integer num_) {
this.num_ = num_;
}

public float avg() {
return total_ / (float) num_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,24 @@ public AvgCount(int total, int num) {
public float avg() {
return total_ / (float) num_;
}
public int total_;
public int num_;
private int total_;
private int num_;

public int getTotal_() {
return total_;
}

public void setTotal_(int total_) {
this.total_ = total_;
}

public int getNum_() {
return num_;
}

public void setNum_(int num_) {
this.num_ = num_;
}
}

public static class AvgRegistrator implements KryoRegistrator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,24 @@
public class BasicLoadJson {

public static class Person implements java.io.Serializable {
public String name;
public Boolean lovesPandas;
private String name;
private Boolean lovesPandas;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Boolean getLovesPandas() {
return lovesPandas;
}

public void setLovesPandas(Boolean lovesPandas) {
this.lovesPandas = lovesPandas;
}
}

public static class ParseJson implements FlatMapFunction<Iterator<String>, Person> {
Expand Down
50 changes: 45 additions & 5 deletions src/main/java/com/oreilly/learningsparkexamples/java/CallLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,49 @@
import java.io.Serializable;

public class CallLog implements Serializable {
public String callsign;
public Double contactlat;
public Double contactlong;
public Double mylat;
public Double mylong;
private String callsign;
private Double contactlat;
private Double contactlong;
private Double mylat;
private Double mylong;

public String getCallsign() {
return callsign;
}

public void setCallsign(String callsign) {
this.callsign = callsign;
}

public Double getContactlat() {
return contactlat;
}

public void setContactlat(Double contactlat) {
this.contactlat = contactlat;
}

public Double getContactlong() {
return contactlong;
}

public void setContactlong(Double contactlong) {
this.contactlong = contactlong;
}

public Double getMylat() {
return mylat;
}

public void setMylat(Double mylat) {
this.mylat = mylat;
}

public Double getMylong() {
return mylong;
}

public void setMylong(Double mylong) {
this.mylong = mylong;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public CallLog[] call(CallLog[] input) {
ArrayList<CallLog> res = new ArrayList<CallLog>();
if (input != null) {
for (CallLog call: input) {
if (call != null && call.mylat != null && call.mylong != null
&& call.contactlat != null && call.contactlong != null) {
if (call != null && call.getMylat() != null && call.getMylong() != null
&& call.getContactlat() != null && call.getContactlong() != null) {
res.add(call);
}
}
Expand Down Expand Up @@ -174,8 +174,8 @@ public Iterable<Tuple2<String, CallLog[]>> call(Iterator<String> input) {
new FlatMapFunction<CallLog[], String>() { public Iterable<String> call(CallLog[] calls) {
ArrayList<String> latLons = new ArrayList<String>();
for (CallLog call: calls) {
latLons.add(call.mylat + "," + call.mylong +
"," + call.contactlat + "," + call.contactlong);
latLons.add(call.getMylat() + "," + call.getMylong() +
"," + call.getContactlat() + "," + call.getContactlong());
}
return latLons;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,27 @@ public AvgCount(int total, int num) {
total_ = total;
num_ = num;
}
public int total_;
public int num_;
private int total_;
private int num_;
public float avg() {
return total_ / (float) num_;
}

public int getTotal_() {
return total_;
}

public void setTotal_(int total_) {
this.total_ = total_;
}

public int getNum_() {
return num_;
}

public void setNum_(int num_) {
this.num_ = num_;
}
}
public static void main(String[] args) throws Exception {
String master;
Expand Down