...
Here is a sample code to demonstrate above guidelines:
class MyClass {
public static final String CONFIG_INDEX_TYPE = "index.type";
public static final String CONFIG_INDEX_TYPE_DEF_VALUE = "solr";
private static final Logger LOG = LoggerFactory.getLogger(MyClass.class);
protected final String id;
protected String updatedBy;
private final String name;
private int count;
public static void main(String[] args) {
// ...
}
public MyClass(String name) {
this.id = 0;
this.name = name;
init();
}
public String getId() { return id; }
public String getName() { return name; }
public String getUpdatedBy() { return updatedBy; }
public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; }
public boolean doWork() {
boolean ret = true;
for (int i = 0; i < count; i++) {
if (count > 0 && count % 1000) {
LOG.info(...);
}
test();
}
return ret;
}
private void init() {
this.count = 0;
test();
// ...
}
}