@Test public void testOtherConverter() throws Exception { final PropertyManagement.PropertyConverter<NonSerializableExample> converter = new PropertyManagement.PropertyConverter<NonSerializableExample>() { private static final long serialVersionUID = 1L; @Override public Serializable convert(final NonSerializableExample ob) throws Exception { return Integer.valueOf(1); } @Override public NonSerializableExample convert(final Serializable ob) throws Exception { assertTrue(ob instanceof Integer); return new NonSerializableExample(); } @Override public Class<NonSerializableExample> baseClass() { return NonSerializableExample.class; } }; final PropertyManagement pm = new PropertyManagement( new PropertyManagement.PropertyConverter[] {converter}, new ParameterEnum[] {MyLocalNSEnum.ARG1}, new Object[] {new NonSerializableExample()}); assertTrue(pm.getProperty(MyLocalNSEnum.ARG1, converter) instanceof NonSerializableExample); }
public Object getProperty(final ParameterEnum<?> property) throws Exception { final Serializable value = getPropertyValue(property); if (!Serializable.class.isAssignableFrom(property.getHelper().getBaseClass())) { for (final PropertyConverter converter : converters) { if (converter.baseClass().isAssignableFrom(property.getHelper().getBaseClass())) { return this.validate(property, converter.convert(value)); } } } return this.validate(property, value); }
PropertyManagement implements Serializable { public Object getProperty(final ParameterEnum<?> property) throws Exception { final Serializable value = getPropertyValue(property); if (!Serializable.class.isAssignableFrom(property.getHelper().getBaseClass())) { for (final PropertyConverter converter : converters) { if (converter.baseClass().isAssignableFrom(property.getHelper().getBaseClass())) { return this.validate(property, converter.convert(value)); } } } return this.validate(property, value); } }
PropertyManagement implements Serializable { public Object getProperty(final ParameterEnum<?> property) throws Exception { final Serializable value = getPropertyValue(property); if (!Serializable.class.isAssignableFrom(property.getHelper().getBaseClass())) { for (final PropertyConverter converter : converters) { if (converter.baseClass().isAssignableFrom(property.getHelper().getBaseClass())) { return this.validate(property, converter.convert(value)); } } } return this.validate(property, value); } 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 Object getProperty(final ParameterEnum<?> property) throws Exception { final Serializable value = getPropertyValue(property); if (!Serializable.class.isAssignableFrom(property.getHelper().getBaseClass())) { for (final PropertyConverter converter : converters) { if (converter.baseClass().isAssignableFrom(property.getHelper().getBaseClass())) { return this.validate(property, converter.convert(value)); } } } return this.validate(property, value); } 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 Object getProperty(final ParameterEnum<?> property) throws Exception { final Serializable value = getPropertyValue(property); if (!Serializable.class.isAssignableFrom(property.getHelper().getBaseClass())) { for (final PropertyConverter converter : converters) { if (converter.baseClass().isAssignableFrom(property.getHelper().getBaseClass())) { return this.validate(property, converter.convert(value)); } } } return this.validate(property, value); } 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);  }