static java.util.Date convertFromGoogleDate(com.google.type.Date date) { Calendar cal = Calendar.getInstance(); cal.setLenient(false); cal.set(Calendar.YEAR, date.getYear()); // Months start at 0, not 1 cal.set(Calendar.MONTH, date.getMonth() - 1); cal.set(Calendar.DAY_OF_MONTH, date.getDay()); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.type.Date)) { return super.equals(obj); } com.google.type.Date other = (com.google.type.Date) obj; boolean result = true; result = result && (getYear() == other.getYear()); result = result && (getMonth() == other.getMonth()); result = result && (getDay() == other.getDay()); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + YEAR_FIELD_NUMBER; hash = (53 * hash) + getYear(); hash = (37 * hash) + MONTH_FIELD_NUMBER; hash = (53 * hash) + getMonth(); hash = (37 * hash) + DAY_FIELD_NUMBER; hash = (53 * hash) + getDay(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.type.Date other) { if (other == com.google.type.Date.getDefaultInstance()) return this; if (other.getYear() != 0) { setYear(other.getYear()); } if (other.getMonth() != 0) { setMonth(other.getMonth()); } if (other.getDay() != 0) { setDay(other.getDay()); } onChanged(); return this; }