phenopackets / phenopacket-tools

An app and library for building, conversion, and validation of GA4GH Phenopackets.
http://phenopackets.org/phenopacket-tools/stable/
GNU General Public License v3.0
13 stars 5 forks source link

MetaDataBuilder #34

Closed pnrobinson closed 2 years ago

pnrobinson commented 2 years ago

Add factory method that takes a time stamp This would enable us to simplify calls like this

 return  MetaData.newBuilder()
                    .setCreated(createdOn)
                    .setCreatedBy(createdBy)
                    .addAllUpdates(updates)
                    .addResources(Resources.hpoVersion(hpoVersion))
                    .build();
pnrobinson commented 2 years ago

Added this

   public static MetaDataBuilder builder(String createdBy) {
        Instant time = Instant.now();
        Timestamp timestamp = Timestamp.newBuilder().setSeconds(time.getEpochSecond())
                .setNanos(time.getNano()).build();
        return new MetaDataBuilder(timestamp, createdBy);
    }