@Test public void testBuilder() { Attribute att = new Attribute("attName", "value"); Dimension dim = new Dimension("dimName", 42); Group.Builder nested = Group.builder().setName("child"); Variable.Builder<?> vb = Variable.builder().setName("varName").setDataType(DataType.STRING); Group group = Group.builder().setName("name").addAttribute(att).addDimension(dim).addGroup(nested).addVariable(vb).build(); assertThat(group.getShortName()).isEqualTo("name"); assertThat(group.isRoot()).isTrue(); assertThat(group.attributes()).isNotEmpty(); assertThat(group.attributes()).hasSize(1); assertThat(group.findAttribute("attName")).isEqualTo(att); assertThat(group.findAttributeString("attName", null)).isEqualTo("value"); assertThat(group.getDimensions()).isNotEmpty(); assertThat(group.getDimensions()).hasSize(1); assertThat(group.findDimension("dimName").isPresent()).isTrue(); assertThat(group.findDimension("dimName").get()).isEqualTo(dim); assertThat(group.getGroups()).isNotEmpty(); assertThat(group.getGroups()).hasSize(1); Group child = group.findGroupLocal("child"); assertThat(child).isNotNull(); assertThat(child.getParentGroup()).isEqualTo(group); assertThat(group.getVariables()).isNotEmpty(); assertThat(group.getVariables()).hasSize(1); Variable v = group.findVariableLocal("varName"); assertThat(v).isNotNull(); assertThat(v.getParentGroup()).isEqualTo(group); }
public static Builder builder() { return new Builder(); }
Group { public static Builder builder() { return new Builder(); } }
Group { public static Builder builder() { return new Builder(); } private  Group(Builder builder, @Nullable Group parent); }
Group { public static Builder builder() { return new Builder(); } private  Group(Builder builder, @Nullable Group parent); AttributeContainer attributes(); Group commonParent(Group other); @Nullable Attribute findAttribute(String name); String findAttributeString(String attName, String defaultValue); Optional<Dimension> findDimension(String name); @Nullable Dimension findDimension(Dimension dim); @Nullable Dimension findDimensionLocal(String shortName); @Nullable EnumTypedef findEnumeration(String name); @Nullable Group findGroupLocal(String groupShortName); Optional<Group> findGroupNested(String groupShortName); @Nullable Variable findVariableByAttribute(String attName, String attValue); @Nullable Variable findVariableLocal(String varShortName); @Nullable Variable findVariableOrInParent(String varShortName); ImmutableList<Dimension> getDimensions(); ImmutableList<EnumTypedef> getEnumTypedefs(); String getFullName(); ImmutableList<Group> getGroups(); NetcdfFile getNetcdfFile(); @Nullable Group getParentGroup(); String getShortName(); ImmutableList<Variable> getVariables(); boolean isParent(Group other); boolean isRoot(); ImmutableList<Dimension> makeDimensionsList(String dimString); String getNameAndAttributes(); @Override String toString(); @Override boolean equals(Object oo); @Override int hashCode(); Builder toBuilder(); static Builder builder(); }
Group { public static Builder builder() { return new Builder(); } private  Group(Builder builder, @Nullable Group parent); AttributeContainer attributes(); Group commonParent(Group other); @Nullable Attribute findAttribute(String name); String findAttributeString(String attName, String defaultValue); Optional<Dimension> findDimension(String name); @Nullable Dimension findDimension(Dimension dim); @Nullable Dimension findDimensionLocal(String shortName); @Nullable EnumTypedef findEnumeration(String name); @Nullable Group findGroupLocal(String groupShortName); Optional<Group> findGroupNested(String groupShortName); @Nullable Variable findVariableByAttribute(String attName, String attValue); @Nullable Variable findVariableLocal(String varShortName); @Nullable Variable findVariableOrInParent(String varShortName); ImmutableList<Dimension> getDimensions(); ImmutableList<EnumTypedef> getEnumTypedefs(); String getFullName(); ImmutableList<Group> getGroups(); NetcdfFile getNetcdfFile(); @Nullable Group getParentGroup(); String getShortName(); ImmutableList<Variable> getVariables(); boolean isParent(Group other); boolean isRoot(); ImmutableList<Dimension> makeDimensionsList(String dimString); String getNameAndAttributes(); @Override String toString(); @Override boolean equals(Object oo); @Override int hashCode(); Builder toBuilder(); static Builder builder();  }