001/* 002 * Copyright (c) 2011-2017 Nexmo Inc 003 * 004 * Permission is hereby granted, free of charge, to any person obtaining a copy 005 * of this software and associated documentation files (the "Software"), to deal 006 * in the Software without restriction, including without limitation the rights 007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 008 * copies of the Software, and to permit persons to whom the Software is 009 * furnished to do so, subject to the following conditions: 010 * 011 * The above copyright notice and this permission notice shall be included in 012 * all copies or substantial portions of the Software. 013 * 014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 020 * THE SOFTWARE. 021 */ 022package com.nexmo.client.insight.advanced; 023 024import com.nexmo.client.insight.BaseInsightRequest; 025import org.apache.commons.lang3.builder.EqualsBuilder; 026 027public class AdvancedInsightRequest extends BaseInsightRequest { 028 private static final Boolean DEFAULT_CNAM = null; 029 private static final String DEFAULT_IP_ADDRESS = null; 030 private final String ipAddress; 031 private final Boolean cnam; 032 033 034 public AdvancedInsightRequest(String number) { 035 this(number, DEFAULT_COUNTRY); 036 } 037 038 public AdvancedInsightRequest(String number, String country) { 039 this(number, country, DEFAULT_IP_ADDRESS); 040 } 041 042 public AdvancedInsightRequest(String number, String country, String ipAddress) { 043 this(number, country, ipAddress, DEFAULT_CNAM); 044 } 045 046 public AdvancedInsightRequest(String number, String country, String ipAddress, Boolean cnam) { 047 super(number, country); 048 this.cnam = cnam; 049 this.ipAddress = ipAddress; 050 } 051 052 public Boolean getCnam() { 053 return cnam; 054 } 055 056 public String getIpAddress() { 057 return ipAddress; 058 } 059 060 @Override 061 public boolean equals(Object obj) { 062 if (obj == null) { 063 return false; 064 } else if (obj == this) { 065 return true; 066 } else if (obj.getClass() != this.getClass()) { 067 return false; 068 } else { 069 AdvancedInsightRequest other = (AdvancedInsightRequest) obj; 070 return new EqualsBuilder() 071 .appendSuper(super.equals(other)) 072 .append(this.getCnam(), other.getCnam()) 073 .append(this.getIpAddress(), other.getIpAddress()) 074 .isEquals(); 075 } 076 } 077}