Duration (Java)
The Age messages use ISO8601 duration strings. These can be easily converted to Java types using the Period class.
import java.time.Period;
Subject subject = phenopacket.getSubject();
if (subject.hasAgeAtCollection()) {
// Phenopacket Age
Age ageAtCollection = subject.getAgeAtCollection();
// Java Period
Period agePeriod = Period.parse(ageAtCollection.getAge());
}