/** * Gets the short textual value of this property from the instant as a * string in the specified locale. * <p> * This method returns the value converted to a <code>String</code> * returning the appropriate textual description wherever possible. * Thus, a day of week of 1 would return 'Mon' in English. * * @param locale locale to use for selecting a text symbol, null means default * @return the current text value * @see DateTimeField#getAsShortText */ public String getAsShortText(Locale locale) { return getField().getAsShortText(getReadablePartial(), get(), locale); }
/** * Gets the value of this property from the instant as a string. * <p> * This method returns the value converted to a <code>String</code> * using <code>Integer.toString</code>. This method does NOT return * textual descriptions such as 'Monday' or 'January'. * See {@link #getAsText()} and {@link #getAsShortText()} for those. * * @return the current value * @see DateTimeField#get * @since 1.1 */ public String getAsString() { return Integer.toString(get()); }
/** * Gets a suitable hashcode for the object. * * @return the hashcode * @since 1.3 */ public int hashCode() { int hash = 19; hash = 13 * hash + get(); hash = 13 * hash + getFieldType().hashCode(); hash = 13 * hash + getReadablePartial().getChronology().hashCode(); return hash; }
/** * Compare this field to the same field on another partial instant. * <p> * The comparison is based on the value of the same field type, irrespective * of any difference in chronology. Thus, if this property represents the * hourOfDay field, then the hourOfDay field of the other partial will be queried * whether in the same chronology or not. * * @param partial the partial to compare to * @return negative value if this is less, 0 if equal, or positive value if greater * @throws IllegalArgumentException if the instant is null * @throws IllegalArgumentException if the field of this property cannot be queried * on the specified instant */ public int compareTo(ReadablePartial partial) { if (partial == null) { throw new IllegalArgumentException("The instant must not be null"); } int thisValue = get(); int otherValue = partial.get(getFieldType()); if (thisValue < otherValue) { return -1; } else if (thisValue > otherValue) { return 1; } else { return 0; } }
/** * Gets a suitable hashcode for the object. * * @return the hashcode * @since 1.3 */ public int hashCode() { int hash = 19; hash = 13 * hash + get(); hash = 13 * hash + getFieldType().hashCode(); hash = 13 * hash + getReadablePartial().getChronology().hashCode(); return hash; }
/** * Gets the textual value of this property from the instant as a * string in the specified locale. * <p> * This method returns the value converted to a <code>String</code> * returning the appropriate textual description wherever possible. * Thus, a day of week of 1 would return 'Monday' in English. * * @param locale locale to use for selecting a text symbol, null means default * @return the current text value * @see DateTimeField#getAsText */ public String getAsText(Locale locale) { return getField().getAsText(getReadablePartial(), get(), locale); }
/** * Compare this field to the same field on another instant. * <p> * The comparison is based on the value of the same field type, irrespective * of any difference in chronology. Thus, if this property represents the * hourOfDay field, then the hourOfDay field of the other instant will be queried * whether in the same chronology or not. * * @param instant the instant to compare to * @return negative value if this is less, 0 if equal, or positive value if greater * @throws IllegalArgumentException if the instant is null or the instant * doesn't support the field of this property */ public int compareTo(ReadableInstant instant) { if (instant == null) { throw new IllegalArgumentException("The instant must not be null"); } int thisValue = get(); int otherValue = instant.get(getFieldType()); if (thisValue < otherValue) { return -1; } else if (thisValue > otherValue) { return 1; } else { return 0; } }
/** * Gets the value of this property from the instant as a string. * <p> * This method returns the value converted to a <code>String</code> * using <code>Integer.toString</code>. This method does NOT return * textual descriptions such as 'Monday' or 'January'. * See {@link #getAsText()} and {@link #getAsShortText()} for those. * * @return the current value * @see DateTimeField#get * @since 1.1 */ public String getAsString() { return Integer.toString(get()); }
/** * Compares this property to another. * * @param object the object to compare to * @return true if equal */ public boolean equals(Object object) { if (this == object) { return true; } if (object instanceof AbstractPartialFieldProperty == false) { return false; } AbstractPartialFieldProperty other = (AbstractPartialFieldProperty) object; return get() == other.get() && getFieldType() == other.getFieldType() && FieldUtils.equals(getReadablePartial().getChronology(), other.getReadablePartial().getChronology()); }
/** * Gets the textual value of this property from the instant as a * string in the specified locale. * <p> * This method returns the value converted to a <code>String</code> * returning the appropriate textual description wherever possible. * Thus, a day of week of 1 would return 'Monday' in English. * * @param locale locale to use for selecting a text symbol, null means default * @return the current text value * @see DateTimeField#getAsText */ public String getAsText(Locale locale) { return getField().getAsText(getReadablePartial(), get(), locale); }
/** * Compare this field to the same field on another instant. * <p> * The comparison is based on the value of the same field type, irrespective * of any difference in chronology. Thus, if this property represents the * hourOfDay field, then the hourOfDay field of the other instant will be queried * whether in the same chronology or not. * * @param instant the instant to compare to * @return negative value if this is less, 0 if equal, or positive value if greater * @throws IllegalArgumentException if the instant is null or the instant * doesn't support the field of this property */ public int compareTo(ReadableInstant instant) { if (instant == null) { throw new IllegalArgumentException("The instant must not be null"); } int thisValue = get(); int otherValue = instant.get(getFieldType()); if (thisValue < otherValue) { return -1; } else if (thisValue > otherValue) { return 1; } else { return 0; } }
/** * Gets the value of this property from the instant as a string. * <p> * This method returns the value converted to a <code>String</code> * using <code>Integer.toString</code>. This method does NOT return * textual descriptions such as 'Monday' or 'January'. * See {@link #getAsText()} and {@link #getAsShortText()} for those. * * @return the current value * @see DateTimeField#get * @since 1.1 */ public String getAsString() { return Integer.toString(get()); }
/** * Compares this property to another. * * @param object the object to compare to * @return true if equal */ public boolean equals(Object object) { if (this == object) { return true; } if (object instanceof AbstractPartialFieldProperty == false) { return false; } AbstractPartialFieldProperty other = (AbstractPartialFieldProperty) object; return get() == other.get() && getFieldType() == other.getFieldType() && FieldUtils.equals(getReadablePartial().getChronology(), other.getReadablePartial().getChronology()); }
/** * Gets the short textual value of this property from the instant as a * string in the specified locale. * <p> * This method returns the value converted to a <code>String</code> * returning the appropriate textual description wherever possible. * Thus, a day of week of 1 would return 'Mon' in English. * * @param locale locale to use for selecting a text symbol, null means default * @return the current text value * @see DateTimeField#getAsShortText */ public String getAsShortText(Locale locale) { return getField().getAsShortText(getReadablePartial(), get(), locale); }
/** * Compare this field to the same field on another partial instant. * <p> * The comparison is based on the value of the same field type, irrespective * of any difference in chronology. Thus, if this property represents the * hourOfDay field, then the hourOfDay field of the other partial will be queried * whether in the same chronology or not. * * @param partial the partial to compare to * @return negative value if this is less, 0 if equal, or positive value if greater * @throws IllegalArgumentException if the instant is null * @throws IllegalArgumentException if the field of this property cannot be queried * on the specified instant */ public int compareTo(ReadablePartial partial) { if (partial == null) { throw new IllegalArgumentException("The instant must not be null"); } int thisValue = get(); int otherValue = partial.get(getFieldType()); if (thisValue < otherValue) { return -1; } else if (thisValue > otherValue) { return 1; } else { return 0; } }
/** * Gets a suitable hashcode for the object. * * @return the hashcode * @since 1.3 */ public int hashCode() { int hash = 19; hash = 13 * hash + get(); hash = 13 * hash + getFieldType().hashCode(); hash = 13 * hash + getReadablePartial().getChronology().hashCode(); return hash; }
/** * Gets the textual value of this property from the instant as a * string in the specified locale. * <p> * This method returns the value converted to a <code>String</code> * returning the appropriate textual description wherever possible. * Thus, a day of week of 1 would return 'Monday' in English. * * @param locale locale to use for selecting a text symbol, null means default * @return the current text value * @see DateTimeField#getAsText */ public String getAsText(Locale locale) { return getField().getAsText(getReadablePartial(), get(), locale); }
/** * Compare this field to the same field on another instant. * <p> * The comparison is based on the value of the same field type, irrespective * of any difference in chronology. Thus, if this property represents the * hourOfDay field, then the hourOfDay field of the other instant will be queried * whether in the same chronology or not. * * @param instant the instant to compare to * @return negative value if this is less, 0 if equal, or positive value if greater * @throws IllegalArgumentException if the instant is null or the instant * doesn't support the field of this property */ public int compareTo(ReadableInstant instant) { if (instant == null) { throw new IllegalArgumentException("The instant must not be null"); } int thisValue = get(); int otherValue = instant.get(getFieldType()); if (thisValue < otherValue) { return -1; } else if (thisValue > otherValue) { return 1; } else { return 0; } }
/** * Compares this property to another. * * @param object the object to compare to * @return true if equal */ public boolean equals(Object object) { if (this == object) { return true; } if (object instanceof AbstractPartialFieldProperty == false) { return false; } AbstractPartialFieldProperty other = (AbstractPartialFieldProperty) object; return get() == other.get() && getFieldType() == other.getFieldType() && FieldUtils.equals(getReadablePartial().getChronology(), other.getReadablePartial().getChronology()); }
/** * Gets the short textual value of this property from the instant as a * string in the specified locale. * <p> * This method returns the value converted to a <code>String</code> * returning the appropriate textual description wherever possible. * Thus, a day of week of 1 would return 'Mon' in English. * * @param locale locale to use for selecting a text symbol, null means default * @return the current text value * @see DateTimeField#getAsShortText */ public String getAsShortText(Locale locale) { return getField().getAsShortText(getReadablePartial(), get(), locale); }