Package org.silverpeas.core.calendar
Class OperationResult<T extends PlannableOnCalendar,U extends Occurrence>
- java.lang.Object
-
- org.silverpeas.core.calendar.OperationResult<T,U>
-
- Direct Known Subclasses:
CalendarEvent.EventOperationResult
public class OperationResult<T extends PlannableOnCalendar,U extends Occurrence> extends Object
Result of an operation that was performed against an object in the calendar business model like a calendar event and its occurrences for example. A result is a container ofPlannableOnCalendar
objects and/or of one of itsOccurrence
object that have been either spawned or updated by a given business operation.
-
-
Constructor Summary
Constructors Constructor Description OperationResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<T>
created()
Gets the optional created planned object.Optional<U>
instance()
Gets the optional updated instance of a planned object.boolean
isEmpty()
Is this operation result empty?Optional<T>
updated()
Gets the optional updated planned object.<R extends OperationResult<T,U>>
RwithCreated(T created)
Sets to this result the planned object that was created within the operation.<R extends OperationResult<T,U>>
RwithInstance(U instance)
Sets to this result an instance of a planned object that was updated within the operation.<R extends OperationResult<T,U>>
RwithUpdated(T updated)
Sets to this result the planned object that was updated within the operation.
-
-
-
Method Detail
-
withUpdated
public <R extends OperationResult<T,U>> R withUpdated(T updated)
Sets to this result the planned object that was updated within the operation.- Parameters:
updated
- the updated planned object.- Returns:
- itself.
-
withCreated
public <R extends OperationResult<T,U>> R withCreated(T created)
Sets to this result the planned object that was created within the operation.- Parameters:
created
- the created planned object.- Returns:
- itself.
-
withInstance
public <R extends OperationResult<T,U>> R withInstance(U instance)
Sets to this result an instance of a planned object that was updated within the operation.- Parameters:
instance
- the updated instance of a planned object.- Returns:
- itself.
-
updated
public Optional<T> updated()
Gets the optional updated planned object.- Returns:
- an option with the planned object that was updated within an operation. The option is empty if no such object was updated.
-
created
public Optional<T> created()
Gets the optional created planned object.- Returns:
- an option with the planned object that was created within an operation. The option is empty if no such object was created.
-
instance
public Optional<U> instance()
Gets the optional updated instance of a planned object.- Returns:
- an option with the instance of a planned object that was updated within an operation. The option is empty if no such instance was updated.
-
isEmpty
public boolean isEmpty()
Is this operation result empty? A result is empty if the operation concludes in no update nor creation of a resource. This is can be for a deletion for example.- Returns:
- true if there is no result, false otherwise.
-
-