Holger's Java API

## com.antelmann.crm
Class PropertyEntryWithAddress

    java.lang.Object
      com.antelmann.db.AbstractDBEntry
          com.antelmann.db.PropertyEntryImpl
              com.antelmann.crm.PropertyEntryWithAddress

All Implemented Interfaces:
  Addressable, DBEntry, PropertyEntry, Converter<Map<?,?>,GlobalAddress>, DetailedString, Serializable

    public class PropertyEntryWithAddress

extends PropertyEntryImpl
implements Addressable, Converter<Map<?,?>,GlobalAddress>

implements a PropertyEntry that stores a `GlobalAddress` through its properties; this class can also serve as a configuration helper for a mapper that embeds storing a GlobalAddress.

Author:
  Holger Antelmann
See Also:
  `GlobalAddress`, `AddressKey`, Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface com.antelmann.util.Converter
`Converter.Adapter<T1,T2>`

Field Summary

Fields inherited from class com.antelmann.db.PropertyEntryImpl
`propertyChangeSupport, props, um, vcs`

Fields inherited from interface com.antelmann.db.DBEntry
`ENTRY_FLAVOR, ENTRY_LIST_FLAVOR`

Constructor Summary
`PropertyEntryWithAddress()` convenience constructor when used only as a configuration object
`PropertyEntryWithAddress(InputStream in)` loads Properties from the given stream and uses that to configure this instance
`PropertyEntryWithAddress(Map<?,?> keyMap)` constructs an instance that can be used as a configuration for mapping
`PropertyEntryWithAddress(Object id)`
`PropertyEntryWithAddress(Object id, Map<String,?> map)`
`PropertyEntryWithAddress(Object id, PropertyEntry pe)`

Method Summary
`void` `addressToProperties(boolean useChangePropertyMethod)` transfers the embedded address into the properties (to be called before this instance is stored back into the database)
`void` `addressToProperties(GlobalAddress address, Map<String,Object> props)` this transformation is strictly based solely on Strings or Double (not PhoneNumber, URL, or the alike); the given map must support mapping to null values
`void` `addressToProperties(GlobalAddress address, PropertyEntry entry)` this transformation is strictly based solely on Strings or Double (not PhoneNumber, URL, or the alike)
`protected void` `checkPropertyChange(String key, Object value)` determines whether a property can be changed as given.
`void` `clearAddressKeys()`
`GlobalAddress` `convert(Map<?,?> map)`
`HashMap<String,Object>` `convertBack(GlobalAddress address)`
`GlobalAddress` `getAddress()` always returns a non-null value referring directly to the embedded main Address instance, which provides a way to 'address' the implementing instance
`String` `getAddressKey(AddressKey key)`
`String` `getAddressKey(String addressKeyName)`
`Map<AddressKey,String>` `getAddressMap()` returns an unmodifiable view of the embedded map
`Set<AddressKey>` `getMissingKeys()`
`protected void` `propertiesToAddress()` transfers the properties to the embedded address and also clears the properties, so that the data is not in there twice (to be called after initialization, before the address can be used).
`void` `propertiesToAddress(Map<String,Object> props, GlobalAddress address)` this transformation is strictly based solely on Strings (not PhoneNumber, URL, or the alike)
`void` `removeAddressKey(AddressKey key)`
`void` `removeAddressKey(String key)`
`void` `setAddressKey(AddressKey key, String columnName)`
`void` `setAddressKey(Object key, String columnName)`
`void` `setAddressKey(String key, String columnName)`
`void` `setAddressKeyMap(Hashtable<AddressKey,String> map)` sets the embedded map with this instance, i.e. subsequent changes, like `setAddressKey(AddressKey, String)`, will be reflected in the given map.
`void` `setAddressKeyMap(MappingInfo mi)`
`void` `setAddressKeys(Map<AddressKey,String> template)`
`void` `verifyProperties()` This default implementation simply runs all existing properties through `checkPropertyChange(String, Object)`.

Methods inherited from class com.antelmann.db.PropertyEntryImpl

`addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, asProperties, canRedo, canUndo, clearProperties, containsPropertyText, containsValuePattern, equalWithProperties, equalWithProperties, getBoolean, getNumber, getProperties, getProperty, getProperty, getPropertyChangeListeners, getPropertyComparator, getPropertyExtractor, getPropertyExtractor, getPropertyKeys, getStringExtractor, getVetoableChangeListeners, isCaseInsensitive, isChangeListenerSupportEnabled, isKeyIn, isUndoSupport, isVetoableChangeSupportEnabled, putAll, redo, removeProperty, removePropertyChangeListener, removeVetoableChangeListener, setAllFrom, setCaseInsensitive, setChangeListenerSupport, setProperty, setUndoSupported, setVetoableChangeSupport, toDetailedString, undo`

Methods inherited from class com.antelmann.db.AbstractDBEntry
`equals, getID, hashCode, hashEntry, sameEntry, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.antelmann.db.DBEntry
`getID`

Constructor Detail

### PropertyEntryWithAddress

    public PropertyEntryWithAddress()

  convenience constructor when used only as a configuration object

### PropertyEntryWithAddress

    public PropertyEntryWithAddress(Object id)

### PropertyEntryWithAddress

    public PropertyEntryWithAddress(Object id,
                                    PropertyEntry pe)

### PropertyEntryWithAddress

    public PropertyEntryWithAddress(Object id,
                                    Map<String,?> map)

### PropertyEntryWithAddress

    public PropertyEntryWithAddress(InputStream in)
                             throws IOException

  loads Properties from the given stream and uses that to configure this instance

  Throws:
    `IOException`
  See Also:
    `PropertyEntryWithAddress(Map)`

### PropertyEntryWithAddress

    public PropertyEntryWithAddress(Map<?,?> keyMap)

  constructs an instance that can be used as a configuration for mapping

  Parameters:
    `keyMap` - maps all keys to their column names
  See Also:
    `AddressKey`

Method Detail

### verifyProperties

    public void verifyProperties()
                          throws IllegalArgumentException

  Description copied from class: `PropertyEntryImpl`
  This default implementation simply runs all existing properties through `checkPropertyChange(String, Object)`. If any implementation requires to check for more (e.g. for missing properties), this method is to be overridden to provide this functionality. Within the implementation of PropertyEntryImpl, this method is never called.

  Overrides:
    `verifyProperties` in class `PropertyEntryImpl`
  Throws:
    `IllegalArgumentException`

### checkPropertyChange

    protected void checkPropertyChange(String key,
                                       Object value)

  Description copied from class: `PropertyEntryImpl`
  determines whether a property can be changed as given. This method is checked on the attempt to change any property; If this method throws an IllegalArgumentException, it is propagated to the caller of setProperty() or removeProperty(). If this is called on the attempt to remove a property, the value is null. This method may be overridden to guarantee a specific consistency of all properties. The message within the IllegalArgumentException allows for specific information on why a property change would not be allowed. This implementation is plain empty, i.e. any change is allowed.

  Overrides:
    `checkPropertyChange` in class `PropertyEntryImpl`
  See Also:
    `PropertyEntryImpl.setProperty(String, Object)`, `PropertyEntryImpl.removeProperty(String)`

### getAddressMap

    public Map<AddressKey,String> getAddressMap()

  returns an unmodifiable view of the embedded map

### getAddressKey

    public String getAddressKey(String addressKeyName)

### getAddressKey

    public String getAddressKey(AddressKey key)

### removeAddressKey

    public void removeAddressKey(String key)

### removeAddressKey

    public void removeAddressKey(AddressKey key)

### setAddressKey

    public void setAddressKey(Object key,
                              String columnName)
                       throws IllegalArgumentException

  Throws:
    `IllegalArgumentException`

### setAddressKey

    public void setAddressKey(String key,
                              String columnName)
                       throws IllegalArgumentException

  Throws:
    `IllegalArgumentException`

### setAddressKey

    public void setAddressKey(AddressKey key,
                              String columnName)

### clearAddressKeys

    public void clearAddressKeys()

### setAddressKeys

    public void setAddressKeys(Map<AddressKey,String> template)

### setAddressKeyMap

    public void setAddressKeyMap(Hashtable<AddressKey,String> map)

  sets the embedded map with this instance, i.e. subsequent changes, like `setAddressKey(AddressKey, String)`, will be reflected in the given map.

### setAddressKeyMap

    public void setAddressKeyMap(MappingInfo mi)

### getMissingKeys

    public Set<AddressKey> getMissingKeys()

### convert

    public GlobalAddress convert(Map<?,?> map)
                          throws IllegalArgumentException

  Specified by:
    `convert` in interface `Converter<Map<?,?>,GlobalAddress>`
  Throws:
    `IllegalArgumentException`

### convertBack

    public HashMap<String,Object> convertBack(GlobalAddress address)
                                       throws IllegalArgumentException

  Specified by:
    `convertBack` in interface `Converter<Map<?,?>,GlobalAddress>`
  Throws:
    `IllegalArgumentException`

### addressToProperties

    public void addressToProperties(GlobalAddress address,
                                    PropertyEntry entry)

  this transformation is strictly based solely on Strings or Double (not PhoneNumber, URL, or the alike)

### addressToProperties

    public void addressToProperties(GlobalAddress address,
                                    Map<String,Object> props)

  this transformation is strictly based solely on Strings or Double (not PhoneNumber, URL, or the alike); the given map must support mapping to null values

### addressToProperties

    public void addressToProperties(boolean useChangePropertyMethod)

  transfers the embedded address into the properties (to be called before this instance is stored back into the database)

  Parameters:
    `useChangePropertyMethod` - if true, the setProperty method is used; if false, the properties are set directly via the put method on the protected member props

### getAddress

    public GlobalAddress getAddress()

  Description copied from interface: `Addressable`
  always returns a non-null value referring directly to the embedded main Address instance, which provides a way to 'address' the implementing instance

  Specified by:
    `getAddress` in interface `Addressable`

### propertiesToAddress

    public void propertiesToAddress(Map<String,Object> props,
                                    GlobalAddress address)

  this transformation is strictly based solely on Strings (not PhoneNumber, URL, or the alike)

### propertiesToAddress

    protected void propertiesToAddress()

  transfers the properties to the embedded address and also clears the properties, so that the data is not in there twice (to be called after initialization, before the address can be used). Normally, this should be called by the constructor of an inheriting class - once after all property key names are properly initialized.

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads