Skip to content

Commit

Permalink
Minor improvements (refining toString method for holder)
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad Kolotov <vkolotov@gmail.com>
  • Loading branch information
vkolotov committed Feb 6, 2018
1 parent a2b9248 commit 95b6496
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ public Boolean getBoolean(Boolean def) {
* @return a String representation of the field
*/
public String getString(String def) {
if (field.getFormat().isReal()
&& (field.getDecimalExponent() != null || field.getBinaryExponent() != null)) {
return String.valueOf(getDouble());
}
//TODO any other smart conversions?
return new StringConverter(def).convert(String.class, value);
}

Expand Down Expand Up @@ -340,10 +345,6 @@ public boolean isValueSet() {

@Override
public String toString() {
if (field.getFormat().isReal()
&& (field.getDecimalExponent() != null || field.getBinaryExponent() != null)) {
return String.valueOf(getDouble());
}
return getString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public List<Field> getFields(Characteristic characteristic) {
if (field.getReference() == null) {
fields.add(field);
} else {
//TODO prevent recusion loops
//TODO prevent recursion loops
fields.addAll(getFields(getCharacteristicByType(field.getReference().trim())));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,8 @@ public String getReference() {
public Boolean isUnknown() {
return unknown;
}

public boolean isFlagField() {
return FlagUtils.isFlagsField(this);
}
}

0 comments on commit 95b6496

Please sign in to comment.