Skip to content

Commit

Permalink
Refactoring BaseModelParameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
datumbox committed Mar 22, 2015
1 parent 993952e commit adeec74
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -34,14 +34,19 @@ public abstract class BaseModelParameters implements Learnable {

public BaseModelParameters(DatabaseFactory dbf) {
//Initialize all the BigMap fields

bigMapInitializer(dbf);
}

public final void bigMapInitializer(DatabaseFactory dbf) {
//get all the fields from all the inherited classes
for(Field field : getAllFields(new LinkedList<>(), this.getClass())){

//if the field is annotated with BigMap
if (field.isAnnotationPresent(BigMap.class)) {
field.setAccessible(true);

try {
//call the getBigMap method to load it
field.set(this, dbf.getBigMap(field.getName()));
}
catch (IllegalArgumentException | IllegalAccessException ex) {
Expand Down

0 comments on commit adeec74

Please sign in to comment.