*/
package org.mxchange.jcore.contact;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.Iterator;
+import java.util.Map;
import java.util.Objects;
import org.mxchange.jcore.BaseFrameworkSystem;
import org.mxchange.jcore.client.Client;
/**
- * A general contact
+ * A general contact class which should only be extended.
*
* @author Roland Haeder
* @version 0.0
/**
* House number
*/
- private long houseNumber;
+ private Long houseNumber;
/**
* Flag whether this contact is user's own data
/**
* ZIP code
*/
- private long zipCode;
+ private Long zipCode;
/**
- * No instances can be created of this class
+ * No instances should be created of this class. Better extend this class
+ * and provide proper constructors.
*/
protected BaseContact () {
}
* @return the cellphoneNumber
*/
@Override
- public String getCellphoneNumber () {
+ public final String getCellphoneNumber () {
return this.cellphoneNumber;
}
this.countryCode = countryCode;
}
- /**
- * "Serializes" this object into a CSV string (this time with semicolons)
- *
- * @return "CSV-serialized" version of the stored data
- * @deprecated Don't use this anymore
- */
- @Deprecated
- public String getCsvStringFromStoreableObject () {
- // Trace message
- this.getLogger().trace("CALLED!"); //NOI18N
-
- // Get all together
- String csvString = String.format(
- "\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\"", //NOI18N
- this.isOwnContact(),
- this.getGender().getDatabaseValue(),
- this.getSurname(),
- this.getFamilyName(),
- this.getCompanyName(),
- this.getStreet(),
- this.getZipCode(),
- this.getCity(),
- this.getCountryCode(),
- this.getPhoneNumber(),
- this.getFaxNumber(),
- this.getCellphoneNumber(),
- this.getEmailAddress(),
- this.getBirthday(),
- this.getComment()
- );
-
- // Then return it
- return csvString;
- }
-
/**
* Email address
*
*/
@Override
public String getFamilyName () {
+ //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
return this.familyName;
}
*/
@Override
public final void setFamilyName (final String familyName) {
+ /* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("familyName={0} - CALLED!", familyName));
this.familyName = familyName;
}
* @return the houseNumber
*/
@Override
- public long getHouseNumber () {
+ public Long getHouseNumber () {
return this.houseNumber;
}
* @param houseNumber the houseNumber to set
*/
@Override
- public final void setHouseNumber (final long houseNumber) {
+ public final void setHouseNumber (final Long houseNumber) {
this.houseNumber = houseNumber;
}
* @return Value from field
*/
@Override
- public Object getValueFromColumn (final String columnName) throws IllegalArgumentException {
+ public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName));
* @return the zipCode
*/
@Override
- public final long getZipCode () {
+ public final Long getZipCode () {
return this.zipCode;
}
* @param zipCode the zipCode to set
*/
@Override
- public final void setZipCode (final long zipCode) {
+ public final void setZipCode (final Long zipCode) {
this.zipCode = zipCode;
}
* @return Whether all conditions are met
*/
@Override
- public boolean isValueEqual (final String columnName, final boolean bool) {
+ public boolean isFieldValueEqual (final String columnName, final boolean bool) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
this.getLogger().trace(MessageFormat.format("columnName={0},bool={1} - CALLED!", columnName, bool));
* @return An iterator
*/
@Override
- public Iterator<Object> iterator () {
+ public Iterator<Map.Entry<Field, Object>> iterator () throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return this.fieldIterator(this, "BaseContact");
}
protected final void enableFlagOwnContact () {
this.ownContact = true;
}
+
+ @Override
+ public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value));
+
+ // Call super method
+ this.setValueInStoreableFromColumn(this, "BaseContact", columnName, value);
+
+ // Trace message
+ this.getLogger().trace("EXIT!");
+ }
}