@Test public void testStore() throws Exception { final PropertyManagement pm = new PropertyManagement(); pm.store( ExtractParameters.Extract.QUERY, QueryBuilder.newBuilder().addTypeName("adapterId").indexName("indexId").build()); assertEquals( QueryBuilder.newBuilder().addTypeName("adapterId").indexName("indexId").build(), pm.getPropertyAsQuery(ExtractParameters.Extract.QUERY)); final Path path1 = new Path("http: pm.store(Input.HDFS_INPUT_PATH, path1); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); try (ObjectOutputStream os = new ObjectOutputStream(bos)) { os.writeObject(pm); } final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); try (ObjectInputStream is = new ObjectInputStream(bis)) { final PropertyManagement pm2 = (PropertyManagement) is.readObject(); assertEquals( QueryBuilder.newBuilder().addTypeName("adapterId").indexName("indexId").build(), pm2.getPropertyAsQuery(ExtractParameters.Extract.QUERY)); assertEquals(path1, pm2.getPropertyAsPath(Input.HDFS_INPUT_PATH)); } }
public synchronized <T> void store( final ParameterEnum<?> property, final T value, final PropertyConverter<T> converter) { Serializable convertedValue; try { convertedValue = converter.convert(value); } catch (final Exception e) { throw new IllegalArgumentException( String.format( "Cannot store %s with value %s. Expected type = %s; Error message = %s", property.self().toString(), value.toString(), property.getHelper().getBaseClass().toString(), e.getLocalizedMessage()), e); } localProperties.put(property, convertedValue); addConverter(converter); }
PropertyManagement implements Serializable { public synchronized <T> void store( final ParameterEnum<?> property, final T value, final PropertyConverter<T> converter) { Serializable convertedValue; try { convertedValue = converter.convert(value); } catch (final Exception e) { throw new IllegalArgumentException( String.format( "Cannot store %s with value %s. Expected type = %s; Error message = %s", property.self().toString(), value.toString(), property.getHelper().getBaseClass().toString(), e.getLocalizedMessage()), e); } localProperties.put(property, convertedValue); addConverter(converter); } }
PropertyManagement implements Serializable { public synchronized <T> void store( final ParameterEnum<?> property, final T value, final PropertyConverter<T> converter) { Serializable convertedValue; try { convertedValue = converter.convert(value); } catch (final Exception e) { throw new IllegalArgumentException( String.format( "Cannot store %s with value %s. Expected type = %s; Error message = %s", property.self().toString(), value.toString(), property.getHelper().getBaseClass().toString(), e.getLocalizedMessage()), e); } localProperties.put(property, convertedValue); addConverter(converter); } PropertyManagement();  PropertyManagement(
      final PropertyConverter<?>[] converters,
      final ParameterEnum<?>[] names,
      final Object[] values);  PropertyManagement(final ParameterEnum<?>[] names, final Object[] values);  PropertyManagement(final PropertyManagement pm); }
PropertyManagement implements Serializable { public synchronized <T> void store( final ParameterEnum<?> property, final T value, final PropertyConverter<T> converter) { Serializable convertedValue; try { convertedValue = converter.convert(value); } catch (final Exception e) { throw new IllegalArgumentException( String.format( "Cannot store %s with value %s. Expected type = %s; Error message = %s", property.self().toString(), value.toString(), property.getHelper().getBaseClass().toString(), e.getLocalizedMessage()), e); } localProperties.put(property, convertedValue); addConverter(converter); } PropertyManagement();  PropertyManagement(
      final PropertyConverter<?>[] converters,
      final ParameterEnum<?>[] names,
      final Object[] values);  PropertyManagement(final ParameterEnum<?>[] names, final Object[] values);  PropertyManagement(final PropertyManagement pm); Serializable get(final ParameterEnum<?> propertyName); synchronized void store(
      final ParameterEnum<?> property,
      final T value,
      final PropertyConverter<T> converter); synchronized void store(final ParameterEnum<?> property, final Object value); synchronized Serializable storeIfEmpty(
      final ParameterEnum<?> propertyEnum,
      final Serializable value); synchronized void copy(
      final ParameterEnum<?> propertyNameFrom,
      final ParameterEnum<?> propertyNameTo); synchronized void storeAll(final ParameterEnum<?>[] names, final Object[] values); void setConfig(
      final ParameterEnum<?>[] parameters,
      final Configuration config,
      final Class<?> scope); @SuppressWarnings("unchecked") T getClassInstance(
      final ParameterEnum<?> property,
      final Class<T> iface,
      final Class<?> defaultClass); synchronized boolean hasProperty(final ParameterEnum<?> property); String getPropertyAsString(final ParameterEnum<?> property); Object getProperty(final ParameterEnum<?> property); T getProperty(final ParameterEnum<?> property, final PropertyConverter<T> converter); byte[] getPropertyAsBytes(final ParameterEnum<?> property); String getPropertyAsString(final ParameterEnum<?> property, final String defaultValue); Boolean getPropertyAsBoolean(final ParameterEnum<?> property, final Boolean defaultValue); Integer getPropertyAsInt(final ParameterEnum<?> property, final int defaultValue); Double getPropertyAsDouble(final ParameterEnum<?> property, final double defaultValue); NumericRange getPropertyAsRange(
      final ParameterEnum<?> property,
      final NumericRange defaultValue); Class<?> getPropertyAsClass(final ParameterEnum<?> property); Class<T> getPropertyAsClass(final ParameterEnum<?> property, final Class<T> iface); Class<? extends T> getPropertyAsClass(
      final ParameterEnum<?> property,
      final Class<? extends T> iface,
      final Class<? extends T> defaultClass); Query<?> getPropertyAsQuery(final ParameterEnum property); Path getPropertyAsPath(final ParameterEnum<?> property); Persistable getPropertyAsPersistable(final ParameterEnum<?> property); void setJobConfiguration(final Configuration configuration, final Class<?> scope); void dump(); synchronized void addConverter(final PropertyConverter<?> converter); }
PropertyManagement implements Serializable { public synchronized <T> void store( final ParameterEnum<?> property, final T value, final PropertyConverter<T> converter) { Serializable convertedValue; try { convertedValue = converter.convert(value); } catch (final Exception e) { throw new IllegalArgumentException( String.format( "Cannot store %s with value %s. Expected type = %s; Error message = %s", property.self().toString(), value.toString(), property.getHelper().getBaseClass().toString(), e.getLocalizedMessage()), e); } localProperties.put(property, convertedValue); addConverter(converter); } PropertyManagement();  PropertyManagement(
      final PropertyConverter<?>[] converters,
      final ParameterEnum<?>[] names,
      final Object[] values);  PropertyManagement(final ParameterEnum<?>[] names, final Object[] values);  PropertyManagement(final PropertyManagement pm); Serializable get(final ParameterEnum<?> propertyName); synchronized void store(
      final ParameterEnum<?> property,
      final T value,
      final PropertyConverter<T> converter); synchronized void store(final ParameterEnum<?> property, final Object value); synchronized Serializable storeIfEmpty(
      final ParameterEnum<?> propertyEnum,
      final Serializable value); synchronized void copy(
      final ParameterEnum<?> propertyNameFrom,
      final ParameterEnum<?> propertyNameTo); synchronized void storeAll(final ParameterEnum<?>[] names, final Object[] values); void setConfig(
      final ParameterEnum<?>[] parameters,
      final Configuration config,
      final Class<?> scope); @SuppressWarnings("unchecked") T getClassInstance(
      final ParameterEnum<?> property,
      final Class<T> iface,
      final Class<?> defaultClass); synchronized boolean hasProperty(final ParameterEnum<?> property); String getPropertyAsString(final ParameterEnum<?> property); Object getProperty(final ParameterEnum<?> property); T getProperty(final ParameterEnum<?> property, final PropertyConverter<T> converter); byte[] getPropertyAsBytes(final ParameterEnum<?> property); String getPropertyAsString(final ParameterEnum<?> property, final String defaultValue); Boolean getPropertyAsBoolean(final ParameterEnum<?> property, final Boolean defaultValue); Integer getPropertyAsInt(final ParameterEnum<?> property, final int defaultValue); Double getPropertyAsDouble(final ParameterEnum<?> property, final double defaultValue); NumericRange getPropertyAsRange(
      final ParameterEnum<?> property,
      final NumericRange defaultValue); Class<?> getPropertyAsClass(final ParameterEnum<?> property); Class<T> getPropertyAsClass(final ParameterEnum<?> property, final Class<T> iface); Class<? extends T> getPropertyAsClass(
      final ParameterEnum<?> property,
      final Class<? extends T> iface,
      final Class<? extends T> defaultClass); Query<?> getPropertyAsQuery(final ParameterEnum property); Path getPropertyAsPath(final ParameterEnum<?> property); Persistable getPropertyAsPersistable(final ParameterEnum<?> property); void setJobConfiguration(final Configuration configuration, final Class<?> scope); void dump(); synchronized void addConverter(final PropertyConverter<?> converter);  }