v2019.1.29
rsmckinney
released this
23 Nov 01:47
·
1040 commits
to master
since this release
New Features (v2019.1.29)
Type-safe CSV Support
Comprehensive support for CSV, interchangeable with JSON, XML, and YAML.
// Type-safely use a CSV file in your resource directory, no code gen
import com.example.MyCsvData; // from resource file: com/example/MyCsvData.csv
import com.example.MyCsvData.MyCsvDataItem;
...
// Load data from the resource file
MyCsvData dataItems = MyCsvData.fromSource();
// Access rows of data type-safely
for (MyCsvData.MyCsvDataItem item: dataItems) {
String name = item.getLastName();
LocalDateTime startDate = item.getStartDate();
...
}
Type-safe XML Support
Comprehensive support for XML, interchangeable with JSON, YAML, and CSV.
// Type-safely use an XML file in your resource directory
import com.example.config.MyXmlConfig;
...
// Load data from the resource file
MyXmlConfig config = MyXmlConfig.fromSource();
// Access elements/attributes type-safely
var linesOfBusiness = config.getEnvironment().getLinesOfBusiness();
...
New Features (v2019.1.21)
Operator Overloading
Implement operator methods on any type to directly support arithmetic, relational, and unit operators.
// BigDecimal expressions
if (bigDec1 > bigDec2) {
BigDecimal result = bigDec1 + bigDec2;
...
}
// Implemnet operators for any type
MyType value = myType1 + myType2;
Unit Expressions
Unit or binding operations are unique to the Manifold framework. They provide a powerfully concise syntax and can be applied to a wide range of applications.
import static manifold.science.util.UnitConstants.*; // kg, m, s, ft, etc
...
Length distance = 100 mph * 3 hr;
Force f = 5.2 kg m/s/s; // same as 5.2 N
Mass infant = 9 lb + 8.71 oz;
Ranges
Easily work with the Range
API using unit expressions. Simply import the RangeFun
constants to create ranges.
// imports the `to`, `step`, and other "binding" constants
import static manifold.collections.api.range.RangeFun.*;
...
for (int i: 1 to 5) {
out.println(i);
}
for (Mass m: 0kg to 10kg step 22r unit g) {
out.println(m);
}
Science
Use the manifold-science framework to type-safely incorporate units and precise measurements into your applications.
import static manifold.science.util.UnitConstants.*; // kg, m, s, ft, etc.
...
Velocity rate = 65mph;
Time time = 1min + 3.7sec;
Length distance = rate * time;