]> git.mxchange.org Git - jphone-core.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Wed, 7 Sep 2016 16:05:26 +0000 (18:05 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 7 Sep 2016 16:05:26 +0000 (18:05 +0200)
- added copyAll() + used it to copy only values

src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java
src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java
src/org/mxchange/jphone/phonenumbers/mobile/MobileNumber.java
src/org/mxchange/jphone/phonenumbers/mobileprovider/CellphoneProvider.java
src/org/mxchange/jphone/phonenumbers/mobileprovider/MobileProvider.java

index e9774de0affcf6873601956088422f9f6dce9d17..0e2cf057d971286fbb82295615535c9ee460d1b0 100644 (file)
@@ -127,9 +127,15 @@ public class FaxNumber implements DialableFaxNumber {
 
        @Override
        public void copyAll (final DialableFaxNumber sourceNumber) {
+               // Validate instance
+               if (null == sourceNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("sourceNumber is null"); //NOI18N
+               }
+
                // Copy all
                this.setPhoneAreaCode(sourceNumber.getPhoneAreaCode());
-               this.setPhoneCountry(sourceNumber.getPhoneCountry());
+               this.getPhoneCountry().copyAll(sourceNumber.getPhoneCountry());
                this.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated());
                this.setPhoneId(sourceNumber.getPhoneId());
                this.setPhoneNumber(sourceNumber.getPhoneNumber());
index 7411cf5894eceea4ecad2ac7bb721d787e1924b8..b9ca58cf35ba8fdd9fc9c118667f4fd596b0b8aa 100644 (file)
@@ -127,9 +127,15 @@ public class LandLineNumber implements DialableLandLineNumber {
 
        @Override
        public void copyAll (final DialableLandLineNumber sourceNumber) {
+               // Validate instance
+               if (null == sourceNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("sourceNumber is null"); //NOI18N
+               }
+
                // Copy all
                this.setPhoneAreaCode(sourceNumber.getPhoneAreaCode());
-               this.setPhoneCountry(sourceNumber.getPhoneCountry());
+               this.getPhoneCountry().copyAll(sourceNumber.getPhoneCountry());
                this.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated());
                this.setPhoneId(sourceNumber.getPhoneId());
                this.setPhoneNumber(sourceNumber.getPhoneNumber());
index ac2a0c2b1c91f9e1603959f68c464655b6a19422..d553c9437634010bd53bf77932d756a1b18b848c 100644 (file)
@@ -119,8 +119,14 @@ public class MobileNumber implements DialableMobileNumber {
 
        @Override
        public void copyAll (final DialableMobileNumber sourceNumber) {
+               // Validate instance
+               if (null == sourceNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("sourceNumber is null"); //NOI18N
+               }
+
                // Copy all
-               this.setMobileProvider(sourceNumber.getMobileProvider());
+               this.getMobileProvider().copyAll(sourceNumber.getMobileProvider());
                this.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated());
                this.setPhoneId(sourceNumber.getPhoneId());
                this.setPhoneNumber(sourceNumber.getPhoneNumber());
index dc20772cba5bcb3d6ffba5287c8740a405ee5141..b31ce492de5c458181341a46be71fd6e0e64e364 100644 (file)
@@ -123,6 +123,23 @@ public class CellphoneProvider implements MobileProvider {
                this.providerMailPattern = providerMailPattern;
        }
 
+       @Override
+       public void copyAll (final MobileProvider sourceMobileProvider) {
+               // Parameter should not be null
+               if (null == sourceMobileProvider) {
+                       // Throw NPE
+                       throw new NullPointerException("sourceMobileProvider is null"); //NOI18N
+               }
+
+               // Copy all values
+               this.getProviderCountry().copyAll(sourceMobileProvider.getProviderCountry());
+               this.setProviderDialPrefix(sourceMobileProvider.getProviderDialPrefix());
+               this.setProviderEntryCreated(sourceMobileProvider.getProviderEntryCreated());
+               this.setProviderId(sourceMobileProvider.getProviderId());
+               this.setProviderMailPattern(sourceMobileProvider.getProviderMailPattern());
+               this.setProviderName(sourceMobileProvider.getProviderName());
+       }
+
        @Override
        public boolean equals (final Object object) {
                if (null == object) {
index 77fe960193b88ae82d86709d3fdab02b44888511..687ddb7bf3a58c6f5370dcfc751eee8b63f220d8 100644 (file)
@@ -27,6 +27,13 @@ import org.mxchange.jcountry.data.Country;
  */
 public interface MobileProvider extends Serializable {
 
+       /**
+        * Copies all values from source mobile provider to this
+        * <p>
+        * @param sourceMobileProvider Source mobile provider
+        */
+       void copyAll (final MobileProvider sourceMobileProvider);
+
        /**
         * Getter for id number
         * <p>