From: Roland Haeder Date: Sat, 20 Feb 2016 21:05:26 +0000 (+0100) Subject: resorted members X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8ea9f8e2467218b87bb8c7e5c3cbb2233f678ec2;p=jphone-core.git resorted members --- diff --git a/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java b/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java index 2ec89ec..d792811 100644 --- a/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java +++ b/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java @@ -49,14 +49,6 @@ public class CellphoneNumber implements DialableCellphoneNumber, Comparable @@ -98,6 +98,11 @@ public class CellphoneNumber implements DialableCellphoneNumber, Comparable @@ -107,23 +107,38 @@ public class FaxNumber implements DialableFaxNumber, Comparable { private static final long serialVersionUID = 185_878_567_810_590L; /** - * Id number + * Country instance ('s dial data) */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "provider_id", length = 20, nullable = false, updatable = false) - private Long providerId; + @JoinColumn (name = "provider_country_id", nullable = false) + @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.MERGE, optional = false, fetch = FetchType.EAGER) + private Country providerCountry; /** * Provider dial prefix (example: 0177 for German E+) @@ -68,20 +67,6 @@ public class CellphoneProvider implements SmsProvider, Comparable { @Column (name = "provider_dial_prefix", length = 10, nullable = false) private Long providerDialPrefix; - /** - * Name of the provider - */ - @Basic (optional = false) - @Column (name = "provider_name", length = 30, nullable = false) - private String providerName; - - /** - * Country instance ('s dial data) - */ - @JoinColumn (name = "provider_country_id", nullable = false) - @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.MERGE, optional = false, fetch = FetchType.EAGER) - private Country providerCountry; - /** * Timestamp when this entry has been created */ @@ -91,10 +76,19 @@ public class CellphoneProvider implements SmsProvider, Comparable { private Calendar providerEntryCreated; /** - * Protected constructor for JPA + * Id number */ - protected CellphoneProvider () { - } + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "provider_id", length = 20, nullable = false, updatable = false) + private Long providerId; + + /** + * Name of the provider + */ + @Basic (optional = false) + @Column (name = "provider_name", length = 30, nullable = false) + private String providerName; /** * Constructor with all required data @@ -111,34 +105,45 @@ public class CellphoneProvider implements SmsProvider, Comparable { this.providerEntryCreated = providerEntryCreated; } - @Override - public Long getProviderId () { - return this.providerId; + /** + * Protected constructor for JPA + */ + protected CellphoneProvider () { } @Override - public void setProviderId (final Long providerId) { - this.providerId = providerId; + public int compareTo (final SmsProvider provider) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override - public Long getProviderDialPrefix () { - return this.providerDialPrefix; - } + public boolean equals (final Object object) { + if (object == null) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } - @Override - public void setProviderDialPrefix (final Long providerDialPrefix) { - this.providerDialPrefix = providerDialPrefix; - } + final SmsProvider other = (SmsProvider) object; - @Override - public String getProviderName () { - return this.providerName; + if (!Objects.equals(this.getProviderDialPrefix(), other.getProviderDialPrefix())) { + return false; + } else if (!Objects.equals(this.getProviderName(), other.getProviderName())) { + return false; + } else if (!Objects.equals(this.getProviderCountry(), other.getProviderCountry())) { + return false; + } + + return true; } @Override - public void setProviderName (final String providerName) { - this.providerName = providerName; + public int hashCode () { + int hash = 7; + hash = 19 * hash + Objects.hashCode(this.getProviderDialPrefix()); + hash = 19 * hash + Objects.hashCode(this.getProviderName()); + hash = 19 * hash + Objects.hashCode(this.getProviderCountry()); + return hash; } @Override @@ -151,6 +156,16 @@ public class CellphoneProvider implements SmsProvider, Comparable { this.providerCountry = providerCountry; } + @Override + public Long getProviderDialPrefix () { + return this.providerDialPrefix; + } + + @Override + public void setProviderDialPrefix (final Long providerDialPrefix) { + this.providerDialPrefix = providerDialPrefix; + } + @Override public Calendar getProviderEntryCreated () { return this.providerEntryCreated; @@ -162,38 +177,23 @@ public class CellphoneProvider implements SmsProvider, Comparable { } @Override - public int compareTo (final SmsProvider provider) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + public Long getProviderId () { + return this.providerId; } @Override - public boolean equals (final Object object) { - if (object == null) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final SmsProvider other = (SmsProvider) object; - - if (!Objects.equals(this.getProviderDialPrefix(), other.getProviderDialPrefix())) { - return false; - } else if (!Objects.equals(this.getProviderName(), other.getProviderName())) { - return false; - } else if (!Objects.equals(this.getProviderCountry(), other.getProviderCountry())) { - return false; - } + public void setProviderId (final Long providerId) { + this.providerId = providerId; + } - return true; + @Override + public String getProviderName () { + return this.providerName; } @Override - public int hashCode () { - int hash = 7; - hash = 19 * hash + Objects.hashCode(this.getProviderDialPrefix()); - hash = 19 * hash + Objects.hashCode(this.getProviderName()); - hash = 19 * hash + Objects.hashCode(this.getProviderCountry()); - return hash; + public void setProviderName (final String providerName) { + this.providerName = providerName; } }