powsybl-core
powsybl-core copied to clipboard
Reporter: provide a TypedValue constructor overload for undefined type
-
Do you want to request a feature or report a bug? Feature
-
What is the current behavior? We should provide a
TypedValue
constructor overload in case of an undefined type.
reporter.createSubReporter("lfNetwork", "Network CC${networkNumCc} SC${networkNumSc}",
Map.of(NETWORK_NUM_CC, new TypedValue(networkNumCc, TypedValue.UNTYPED),
NETWORK_NUM_SC, new TypedValue(networkNumSc, TypedValue.UNTYPED)));
- What is the expected behavior?
could be written
reporter.createSubReporter("lfNetwork", "Network CC${networkNumCc} SC${networkNumSc}",
Map.of(NETWORK_NUM_CC, new TypedValue(networkNumCc),
NETWORK_NUM_SC, new TypedValue(networkNumSc)));
Or even better
reporter.createSubReporter("lfNetwork", "Network CC${networkNumCc} SC${networkNumSc}",
Map.of(NETWORK_NUM_CC, TypedValue.of(networkNumCc),
NETWORK_NUM_SC, TypedValue.of(networkNumSc)));
And provides an overload for all supported types to avoid .of(Object obj)
-
What is the motivation / use case for changing the behavior?
-
Please tell us about your environment:
- PowSyBl Version: ...
- OS Version: ...
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, spectrum, etc)
(if a question doesn't apply, you can delete it)
Maybe TypedValue.untyped(value)
to be more explicit ?
TypedValue cannot be instantiated anymore, adder/builder should be used instead with methods:
-
withTypedValue(valueKey, value, type)
-
withUntypedValue(valueKey, value)