com.microsoft.graph.generated.models.BaseItemVersion Maven / Gradle / Ivy
package com.microsoft.graph.models;
import com.microsoft.kiota.serialization.Parsable;
import com.microsoft.kiota.serialization.ParseNode;
import com.microsoft.kiota.serialization.SerializationWriter;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@jakarta.annotation.Generated("com.microsoft.kiota")
public class BaseItemVersion extends Entity implements Parsable {
/**
* Instantiates a new {@link BaseItemVersion} and sets the default values.
*/
public BaseItemVersion() {
super();
}
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @return a {@link BaseItemVersion}
*/
@jakarta.annotation.Nonnull
public static BaseItemVersion createFromDiscriminatorValue(@jakarta.annotation.Nonnull final ParseNode parseNode) {
Objects.requireNonNull(parseNode);
final ParseNode mappingValueNode = parseNode.getChildNode("@odata.type");
if (mappingValueNode != null) {
final String mappingValue = mappingValueNode.getStringValue();
switch (mappingValue) {
case "#microsoft.graph.documentSetVersion": return new DocumentSetVersion();
case "#microsoft.graph.driveItemVersion": return new DriveItemVersion();
case "#microsoft.graph.listItemVersion": return new ListItemVersion();
}
}
return new BaseItemVersion();
}
/**
* The deserialization information for the current model
* @return a {@link Map>}
*/
@jakarta.annotation.Nonnull
public Map> getFieldDeserializers() {
final HashMap> deserializerMap = new HashMap>(super.getFieldDeserializers());
deserializerMap.put("lastModifiedBy", (n) -> { this.setLastModifiedBy(n.getObjectValue(IdentitySet::createFromDiscriminatorValue)); });
deserializerMap.put("lastModifiedDateTime", (n) -> { this.setLastModifiedDateTime(n.getOffsetDateTimeValue()); });
deserializerMap.put("publication", (n) -> { this.setPublication(n.getObjectValue(PublicationFacet::createFromDiscriminatorValue)); });
return deserializerMap;
}
/**
* Gets the lastModifiedBy property value. Identity of the user which last modified the version. Read-only.
* @return a {@link IdentitySet}
*/
@jakarta.annotation.Nullable
public IdentitySet getLastModifiedBy() {
return this.backingStore.get("lastModifiedBy");
}
/**
* Gets the lastModifiedDateTime property value. Date and time the version was last modified. Read-only.
* @return a {@link OffsetDateTime}
*/
@jakarta.annotation.Nullable
public OffsetDateTime getLastModifiedDateTime() {
return this.backingStore.get("lastModifiedDateTime");
}
/**
* Gets the publication property value. Indicates the publication status of this particular version. Read-only.
* @return a {@link PublicationFacet}
*/
@jakarta.annotation.Nullable
public PublicationFacet getPublication() {
return this.backingStore.get("publication");
}
/**
* Serializes information the current object
* @param writer Serialization writer to use to serialize this model
*/
public void serialize(@jakarta.annotation.Nonnull final SerializationWriter writer) {
Objects.requireNonNull(writer);
super.serialize(writer);
writer.writeObjectValue("lastModifiedBy", this.getLastModifiedBy());
writer.writeOffsetDateTimeValue("lastModifiedDateTime", this.getLastModifiedDateTime());
writer.writeObjectValue("publication", this.getPublication());
}
/**
* Sets the lastModifiedBy property value. Identity of the user which last modified the version. Read-only.
* @param value Value to set for the lastModifiedBy property.
*/
public void setLastModifiedBy(@jakarta.annotation.Nullable final IdentitySet value) {
this.backingStore.set("lastModifiedBy", value);
}
/**
* Sets the lastModifiedDateTime property value. Date and time the version was last modified. Read-only.
* @param value Value to set for the lastModifiedDateTime property.
*/
public void setLastModifiedDateTime(@jakarta.annotation.Nullable final OffsetDateTime value) {
this.backingStore.set("lastModifiedDateTime", value);
}
/**
* Sets the publication property value. Indicates the publication status of this particular version. Read-only.
* @param value Value to set for the publication property.
*/
public void setPublication(@jakarta.annotation.Nullable final PublicationFacet value) {
this.backingStore.set("publication", value);
}
}