/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://aws.amazon.com/apache2.0
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and
* limitations under the License.
*/
package com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Calendar;
import java.util.Date;
/**
* Simple domain class with numeric attributes
*/
@DynamoDBTable(tableName = "aws-java-sdk-util")
public class NumberAttributeClass {
private String key;
private int intAttribute;
private Integer integerAttribute;
private double doubleAttribute;
private Double doubleObjectAttribute;
private float floatAttribute;
private Float floatObjectAttribute;
private BigDecimal bigDecimalAttribute;
private BigInteger bigIntegerAttribute;
private long longAttribute;
private Long longObjectAttribute;
private short shortAttribute;
private Short shortObjectAttribute;
private byte byteAttribute;
private Byte byteObjectAttribute;
private Date dateAttribute;
private Calendar calendarAttribute;
private Boolean booleanObjectAttribute;
private boolean booleanAttribute;
private String ignored = "notSent";
@DynamoDBAutoGeneratedKey
@DynamoDBHashKey
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public int getIntAttribute() {
return intAttribute;
}
public void setIntAttribute(int intAttribute) {
this.intAttribute = intAttribute;
}
public Integer getIntegerAttribute() {
return integerAttribute;
}
public void setIntegerAttribute(Integer integerAttribute) {
this.integerAttribute = integerAttribute;
}
public double getDoubleAttribute() {
return doubleAttribute;
}
public void setDoubleAttribute(double doubleAttribute) {
this.doubleAttribute = doubleAttribute;
}
public Double getDoubleObjectAttribute() {
return doubleObjectAttribute;
}
public void setDoubleObjectAttribute(Double doubleObjectAttribute) {
this.doubleObjectAttribute = doubleObjectAttribute;
}
@DynamoDBAttribute
public float getFloatAttribute() {
return floatAttribute;
}
public void setFloatAttribute(float floatAttribute) {
this.floatAttribute = floatAttribute;
}
public Float getFloatObjectAttribute() {
return floatObjectAttribute;
}
public void setFloatObjectAttribute(Float floatObjectAttribute) {
this.floatObjectAttribute = floatObjectAttribute;
}
public BigDecimal getBigDecimalAttribute() {
return bigDecimalAttribute;
}
public void setBigDecimalAttribute(BigDecimal bigDecimalAttribute) {
this.bigDecimalAttribute = bigDecimalAttribute;
}
public BigInteger getBigIntegerAttribute() {
return bigIntegerAttribute;
}
public void setBigIntegerAttribute(BigInteger bigIntegerAttribute) {
this.bigIntegerAttribute = bigIntegerAttribute;
}
public long getLongAttribute() {
return longAttribute;
}
public void setLongAttribute(long longAttribute) {
this.longAttribute = longAttribute;
}
public Long getLongObjectAttribute() {
return longObjectAttribute;
}
public void setLongObjectAttribute(Long longObjectAttribute) {
this.longObjectAttribute = longObjectAttribute;
}
public byte getByteAttribute() {
return byteAttribute;
}
public void setByteAttribute(byte byteAttribute) {
this.byteAttribute = byteAttribute;
}
public Byte getByteObjectAttribute() {
return byteObjectAttribute;
}
public void setByteObjectAttribute(Byte byteObjectAttribute) {
this.byteObjectAttribute = byteObjectAttribute;
}
public Date getDateAttribute() {
return dateAttribute;
}
public void setDateAttribute(Date dateAttribute) {
this.dateAttribute = dateAttribute;
}
public Calendar getCalendarAttribute() {
return calendarAttribute;
}
public void setCalendarAttribute(Calendar calendarAttribute) {
this.calendarAttribute = calendarAttribute;
}
public Boolean getBooleanObjectAttribute() {
return booleanObjectAttribute;
}
public void setBooleanObjectAttribute(Boolean booleanObjectAttribute) {
this.booleanObjectAttribute = booleanObjectAttribute;
}
public boolean isBooleanAttribute() {
return booleanAttribute;
}
public void setBooleanAttribute(boolean booleanAttribute) {
this.booleanAttribute = booleanAttribute;
}
@DynamoDBIgnore
public String getIgnored() {
return ignored;
}
public void setIgnored(String ignored) {
this.ignored = ignored;
}
public short getShortAttribute() {
return shortAttribute;
}
public void setShortAttribute(short shortAttribute) {
this.shortAttribute = shortAttribute;
}
public Short getShortObjectAttribute() {
return shortObjectAttribute;
}
public void setShortObjectAttribute(Short shortObjectAttribute) {
this.shortObjectAttribute = shortObjectAttribute;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((bigDecimalAttribute == null) ? 0 : bigDecimalAttribute.hashCode());
result = prime * result
+ ((bigIntegerAttribute == null) ? 0 : bigIntegerAttribute.hashCode());
result = prime * result + (booleanAttribute ? 1231 : 1237);
result = prime * result
+ ((booleanObjectAttribute == null) ? 0 : booleanObjectAttribute.hashCode());
result = prime * result + byteAttribute;
result = prime * result
+ ((byteObjectAttribute == null) ? 0 : byteObjectAttribute.hashCode());
result = prime * result + ((calendarAttribute == null) ? 0 : calendarAttribute.hashCode());
result = prime * result + ((dateAttribute == null) ? 0 : dateAttribute.hashCode());
long temp;
temp = Double.doubleToLongBits(doubleAttribute);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result
+ ((doubleObjectAttribute == null) ? 0 : doubleObjectAttribute.hashCode());
result = prime * result + Float.floatToIntBits(floatAttribute);
result = prime * result
+ ((floatObjectAttribute == null) ? 0 : floatObjectAttribute.hashCode());
result = prime * result + ((ignored == null) ? 0 : ignored.hashCode());
result = prime * result + intAttribute;
result = prime * result + ((integerAttribute == null) ? 0 : integerAttribute.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + (int) (longAttribute ^ (longAttribute >>> 32));
result = prime * result
+ ((longObjectAttribute == null) ? 0 : longObjectAttribute.hashCode());
result = prime * result + shortAttribute;
result = prime * result
+ ((shortObjectAttribute == null) ? 0 : shortObjectAttribute.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NumberAttributeClass other = (NumberAttributeClass) obj;
if (bigDecimalAttribute == null) {
if (other.bigDecimalAttribute != null)
return false;
} else if (!bigDecimalAttribute.equals(other.bigDecimalAttribute))
return false;
if (bigIntegerAttribute == null) {
if (other.bigIntegerAttribute != null)
return false;
} else if (!bigIntegerAttribute.equals(other.bigIntegerAttribute))
return false;
if (booleanAttribute != other.booleanAttribute)
return false;
if (booleanObjectAttribute == null) {
if (other.booleanObjectAttribute != null)
return false;
} else if (!booleanObjectAttribute.equals(other.booleanObjectAttribute))
return false;
if (byteAttribute != other.byteAttribute)
return false;
if (byteObjectAttribute == null) {
if (other.byteObjectAttribute != null)
return false;
} else if (!byteObjectAttribute.equals(other.byteObjectAttribute))
return false;
if (calendarAttribute == null) {
if (other.calendarAttribute != null)
return false;
} else if (!calendarAttribute.equals(other.calendarAttribute))
return false;
if (dateAttribute == null) {
if (other.dateAttribute != null)
return false;
} else if (!dateAttribute.equals(other.dateAttribute))
return false;
if (Double.doubleToLongBits(doubleAttribute) != Double
.doubleToLongBits(other.doubleAttribute))
return false;
if (doubleObjectAttribute == null) {
if (other.doubleObjectAttribute != null)
return false;
} else if (!doubleObjectAttribute.equals(other.doubleObjectAttribute))
return false;
if (Float.floatToIntBits(floatAttribute) != Float.floatToIntBits(other.floatAttribute))
return false;
if (floatObjectAttribute == null) {
if (other.floatObjectAttribute != null)
return false;
} else if (!floatObjectAttribute.equals(other.floatObjectAttribute))
return false;
if (ignored == null) {
if (other.ignored != null)
return false;
} else if (!ignored.equals(other.ignored))
return false;
if (intAttribute != other.intAttribute)
return false;
if (integerAttribute == null) {
if (other.integerAttribute != null)
return false;
} else if (!integerAttribute.equals(other.integerAttribute))
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (longAttribute != other.longAttribute)
return false;
if (longObjectAttribute == null) {
if (other.longObjectAttribute != null)
return false;
} else if (!longObjectAttribute.equals(other.longObjectAttribute))
return false;
if (shortAttribute != other.shortAttribute)
return false;
if (shortObjectAttribute == null) {
if (other.shortObjectAttribute != null)
return false;
} else if (!shortObjectAttribute.equals(other.shortObjectAttribute))
return false;
return true;
}
}