TemporalAdjusters Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Common and useful TemporalAdjusters.
[Android.Runtime.Register("java/time/temporal/TemporalAdjusters", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class TemporalAdjusters : Java.Lang.Object
[<Android.Runtime.Register("java/time/temporal/TemporalAdjusters", ApiSince=26, DoNotGenerateAcw=true)>]
type TemporalAdjusters = class
inherit Object
- Inheritance
- Attributes
Remarks
Common and useful TemporalAdjusters.
Adjusters are a key tool for modifying temporal objects. They exist to externalize the process of adjustment, permitting different approaches, as per the strategy design pattern. Examples might be an adjuster that sets the date avoiding weekends, or one that sets the date to the last day of the month.
There are two equivalent ways of using a TemporalAdjuster
. The first is to invoke the method on the interface directly. The second is to use Temporal#with(TemporalAdjuster)
:
// these two lines are equivalent, but the second approach is recommended
temporal = thisAdjuster.adjustInto(temporal);
temporal = temporal.with(thisAdjuster);
It is recommended to use the second approach, with(TemporalAdjuster)
, as it is a lot clearer to read in code.
This class contains a standard set of adjusters, available as static methods. These include: <ul> <li>finding the first or last day of the month <li>finding the first day of next month <li>finding the first or last day of the year <li>finding the first day of next year <li>finding the first or last day-of-week within a month, such as "first Wednesday in June" <li>finding the next or previous day-of-week, such as "next Thursday" </ul>
Added in 1.8.
Java documentation for java.time.temporal.TemporalAdjusters
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Properties
Class |
Returns the runtime class of this |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
PeerReference | (Inherited from Object) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
DayOfWeekInMonth(Int32, DayOfWeek) |
Returns the day-of-week in month adjuster, which returns a new date with the ordinal day-of-week based on the month. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
FirstDayOfMonth() |
Returns the "first day of month" adjuster, which returns a new date set to the first day of the current month. |
FirstDayOfNextMonth() |
Returns the "first day of next month" adjuster, which returns a new date set to the first day of the next month. |
FirstDayOfNextYear() |
Returns the "first day of next year" adjuster, which returns a new date set to the first day of the next year. |
FirstDayOfYear() |
Returns the "first day of year" adjuster, which returns a new date set to the first day of the current year. |
FirstInMonth(DayOfWeek) |
Returns the first in month adjuster, which returns a new date in the same month with the first matching day-of-week. |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
LastDayOfMonth() |
Returns the "last day of month" adjuster, which returns a new date set to the last day of the current month. |
LastDayOfYear() |
Returns the "last day of year" adjuster, which returns a new date set to the last day of the current year. |
LastInMonth(DayOfWeek) |
Returns the last in month adjuster, which returns a new date in the same month with the last matching day-of-week. |
Next(DayOfWeek) |
Returns the next day-of-week adjuster, which adjusts the date to the first occurrence of the specified day-of-week after the date being adjusted. |
NextOrSame(DayOfWeek) |
Returns the next-or-same day-of-week adjuster, which adjusts the date to the first occurrence of the specified day-of-week after the date being adjusted unless it is already on that day in which case the same object is returned. |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
OfDateAdjuster(IUnaryOperator) |
Obtains a |
Previous(DayOfWeek) |
Returns the previous day-of-week adjuster, which adjusts the date to the first occurrence of the specified day-of-week before the date being adjusted. |
PreviousOrSame(DayOfWeek) |
Returns the previous-or-same day-of-week adjuster, which adjusts the date to the first occurrence of the specified day-of-week before the date being adjusted unless it is already on that day in which case the same object is returned. |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |