@Test public void fillPropertyNull() { Configuration configuration = new Configuration("hostname", ConfigurationFormat.CISCO_IOS); String property = NodePropertySpecifier.NTP_SOURCE_INTERFACE; PropertyDescriptor<Configuration> propertyDescriptor = NodePropertySpecifier.getPropertyDescriptor(property); RowBuilder row = Row.builder(); PropertySpecifier.fillProperty(propertyDescriptor, configuration, property, row); assertThat(row.build(), equalTo(Row.builder().put(property, null).build())); }
public static <T> void fillProperty( PropertyDescriptor<T> propertyDescriptor, T object, String columnName, RowBuilder row) { checkArgument(propertyDescriptor != null, "'propertyDescriptor' cannot be null"); checkArgument(object != null, "'object' cannot be null"); checkArgument(columnName != null, "'columnName' cannot be null"); checkArgument(row != null, "'row' cannot be null"); Object propertyValue = propertyDescriptor.getGetter().apply(object); propertyValue = PropertySpecifier.convertTypeIfNeeded(propertyValue, propertyDescriptor.getSchema()); fillProperty(columnName, propertyValue, row, propertyDescriptor); }
PropertySpecifier { public static <T> void fillProperty( PropertyDescriptor<T> propertyDescriptor, T object, String columnName, RowBuilder row) { checkArgument(propertyDescriptor != null, "'propertyDescriptor' cannot be null"); checkArgument(object != null, "'object' cannot be null"); checkArgument(columnName != null, "'columnName' cannot be null"); checkArgument(row != null, "'row' cannot be null"); Object propertyValue = propertyDescriptor.getGetter().apply(object); propertyValue = PropertySpecifier.convertTypeIfNeeded(propertyValue, propertyDescriptor.getSchema()); fillProperty(columnName, propertyValue, row, propertyDescriptor); } }
PropertySpecifier { public static <T> void fillProperty( PropertyDescriptor<T> propertyDescriptor, T object, String columnName, RowBuilder row) { checkArgument(propertyDescriptor != null, "'propertyDescriptor' cannot be null"); checkArgument(object != null, "'object' cannot be null"); checkArgument(columnName != null, "'columnName' cannot be null"); checkArgument(row != null, "'row' cannot be null"); Object propertyValue = propertyDescriptor.getGetter().apply(object); propertyValue = PropertySpecifier.convertTypeIfNeeded(propertyValue, propertyDescriptor.getSchema()); fillProperty(columnName, propertyValue, row, propertyDescriptor); }  }
PropertySpecifier { public static <T> void fillProperty( PropertyDescriptor<T> propertyDescriptor, T object, String columnName, RowBuilder row) { checkArgument(propertyDescriptor != null, "'propertyDescriptor' cannot be null"); checkArgument(object != null, "'object' cannot be null"); checkArgument(columnName != null, "'columnName' cannot be null"); checkArgument(row != null, "'row' cannot be null"); Object propertyValue = propertyDescriptor.getGetter().apply(object); propertyValue = PropertySpecifier.convertTypeIfNeeded(propertyValue, propertyDescriptor.getSchema()); fillProperty(columnName, propertyValue, row, propertyDescriptor); }  static Object convertTypeIfNeeded(Object propertyValue, Schema targetSchema); static void fillProperty(
      PropertyDescriptor<T> propertyDescriptor, T object, String columnName, RowBuilder row); abstract List<String> getMatchingProperties(); }
PropertySpecifier { public static <T> void fillProperty( PropertyDescriptor<T> propertyDescriptor, T object, String columnName, RowBuilder row) { checkArgument(propertyDescriptor != null, "'propertyDescriptor' cannot be null"); checkArgument(object != null, "'object' cannot be null"); checkArgument(columnName != null, "'columnName' cannot be null"); checkArgument(row != null, "'row' cannot be null"); Object propertyValue = propertyDescriptor.getGetter().apply(object); propertyValue = PropertySpecifier.convertTypeIfNeeded(propertyValue, propertyDescriptor.getSchema()); fillProperty(columnName, propertyValue, row, propertyDescriptor); }  static Object convertTypeIfNeeded(Object propertyValue, Schema targetSchema); static void fillProperty(
      PropertyDescriptor<T> propertyDescriptor, T object, String columnName, RowBuilder row); abstract List<String> getMatchingProperties();  }