Adding getTextByValue method to replace duplicate code (#823)
* Added FormattedTextValue.getTextByValue() * changed getBoolean() and added to display_title
This commit is contained in:
1 parent
de92d47f70
commit
e26e332a6d
4 files changed
+14
-34
No files matched your search
@@ -54,7 +54,7 @@ public class FormattedTextValue extends StringValue
|
||||
|
||||
@Override
|
||||
public boolean getBoolean() {
|
||||
return text.getSiblings().size() > 0;
|
||||
return !text.asString().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,4 +96,8 @@ public class FormattedTextValue extends StringValue
|
||||
return new FormattedTextValue(Text.Serializer.fromJson(serialized));
|
||||
}
|
||||
|
||||
public static Text getTextByValue(Value value) {
|
||||
return (value instanceof FormattedTextValue) ? ((FormattedTextValue) value).getText() : new LiteralText(value.getString());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user