All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.workdocs.model.DocumentMetadata Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon WorkDocs module holds the client classes that are used for communicating with Amazon WorkDocs Service.

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.workdocs.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Describes the document. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DocumentMetadata implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id") .getter(getter(DocumentMetadata::id)).setter(setter(Builder::id)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build(); private static final SdkField CREATOR_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("CreatorId").getter(getter(DocumentMetadata::creatorId)).setter(setter(Builder::creatorId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatorId").build()).build(); private static final SdkField PARENT_FOLDER_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ParentFolderId").getter(getter(DocumentMetadata::parentFolderId)) .setter(setter(Builder::parentFolderId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParentFolderId").build()).build(); private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreatedTimestamp").getter(getter(DocumentMetadata::createdTimestamp)) .setter(setter(Builder::createdTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build()).build(); private static final SdkField MODIFIED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("ModifiedTimestamp").getter(getter(DocumentMetadata::modifiedTimestamp)) .setter(setter(Builder::modifiedTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModifiedTimestamp").build()).build(); private static final SdkField LATEST_VERSION_METADATA_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("LatestVersionMetadata") .getter(getter(DocumentMetadata::latestVersionMetadata)).setter(setter(Builder::latestVersionMetadata)) .constructor(DocumentVersionMetadata::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LatestVersionMetadata").build()) .build(); private static final SdkField RESOURCE_STATE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ResourceState").getter(getter(DocumentMetadata::resourceStateAsString)) .setter(setter(Builder::resourceState)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceState").build()).build(); private static final SdkField> LABELS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Labels") .getter(getter(DocumentMetadata::labels)) .setter(setter(Builder::labels)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Labels").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, CREATOR_ID_FIELD, PARENT_FOLDER_ID_FIELD, CREATED_TIMESTAMP_FIELD, MODIFIED_TIMESTAMP_FIELD, LATEST_VERSION_METADATA_FIELD, RESOURCE_STATE_FIELD, LABELS_FIELD)); private static final long serialVersionUID = 1L; private final String id; private final String creatorId; private final String parentFolderId; private final Instant createdTimestamp; private final Instant modifiedTimestamp; private final DocumentVersionMetadata latestVersionMetadata; private final String resourceState; private final List labels; private DocumentMetadata(BuilderImpl builder) { this.id = builder.id; this.creatorId = builder.creatorId; this.parentFolderId = builder.parentFolderId; this.createdTimestamp = builder.createdTimestamp; this.modifiedTimestamp = builder.modifiedTimestamp; this.latestVersionMetadata = builder.latestVersionMetadata; this.resourceState = builder.resourceState; this.labels = builder.labels; } /** *

* The ID of the document. *

* * @return The ID of the document. */ public final String id() { return id; } /** *

* The ID of the creator. *

* * @return The ID of the creator. */ public final String creatorId() { return creatorId; } /** *

* The ID of the parent folder. *

* * @return The ID of the parent folder. */ public final String parentFolderId() { return parentFolderId; } /** *

* The time when the document was created. *

* * @return The time when the document was created. */ public final Instant createdTimestamp() { return createdTimestamp; } /** *

* The time when the document was updated. *

* * @return The time when the document was updated. */ public final Instant modifiedTimestamp() { return modifiedTimestamp; } /** *

* The latest version of the document. *

* * @return The latest version of the document. */ public final DocumentVersionMetadata latestVersionMetadata() { return latestVersionMetadata; } /** *

* The resource state. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #resourceState} * will return {@link ResourceStateType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #resourceStateAsString}. *

* * @return The resource state. * @see ResourceStateType */ public final ResourceStateType resourceState() { return ResourceStateType.fromValue(resourceState); } /** *

* The resource state. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #resourceState} * will return {@link ResourceStateType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #resourceStateAsString}. *

* * @return The resource state. * @see ResourceStateType */ public final String resourceStateAsString() { return resourceState; } /** * Returns true if the Labels property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasLabels() { return labels != null && !(labels instanceof SdkAutoConstructList); } /** *

* List of labels on the document. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasLabels()} to see if a value was sent in this field. *

* * @return List of labels on the document. */ public final List labels() { return labels; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(id()); hashCode = 31 * hashCode + Objects.hashCode(creatorId()); hashCode = 31 * hashCode + Objects.hashCode(parentFolderId()); hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(modifiedTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(latestVersionMetadata()); hashCode = 31 * hashCode + Objects.hashCode(resourceStateAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasLabels() ? labels() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DocumentMetadata)) { return false; } DocumentMetadata other = (DocumentMetadata) obj; return Objects.equals(id(), other.id()) && Objects.equals(creatorId(), other.creatorId()) && Objects.equals(parentFolderId(), other.parentFolderId()) && Objects.equals(createdTimestamp(), other.createdTimestamp()) && Objects.equals(modifiedTimestamp(), other.modifiedTimestamp()) && Objects.equals(latestVersionMetadata(), other.latestVersionMetadata()) && Objects.equals(resourceStateAsString(), other.resourceStateAsString()) && hasLabels() == other.hasLabels() && Objects.equals(labels(), other.labels()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("DocumentMetadata").add("Id", id()).add("CreatorId", creatorId()) .add("ParentFolderId", parentFolderId()).add("CreatedTimestamp", createdTimestamp()) .add("ModifiedTimestamp", modifiedTimestamp()).add("LatestVersionMetadata", latestVersionMetadata()) .add("ResourceState", resourceStateAsString()).add("Labels", hasLabels() ? labels() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Id": return Optional.ofNullable(clazz.cast(id())); case "CreatorId": return Optional.ofNullable(clazz.cast(creatorId())); case "ParentFolderId": return Optional.ofNullable(clazz.cast(parentFolderId())); case "CreatedTimestamp": return Optional.ofNullable(clazz.cast(createdTimestamp())); case "ModifiedTimestamp": return Optional.ofNullable(clazz.cast(modifiedTimestamp())); case "LatestVersionMetadata": return Optional.ofNullable(clazz.cast(latestVersionMetadata())); case "ResourceState": return Optional.ofNullable(clazz.cast(resourceStateAsString())); case "Labels": return Optional.ofNullable(clazz.cast(labels())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DocumentMetadata) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the document. *

* * @param id * The ID of the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** *

* The ID of the creator. *

* * @param creatorId * The ID of the creator. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creatorId(String creatorId); /** *

* The ID of the parent folder. *

* * @param parentFolderId * The ID of the parent folder. * @return Returns a reference to this object so that method calls can be chained together. */ Builder parentFolderId(String parentFolderId); /** *

* The time when the document was created. *

* * @param createdTimestamp * The time when the document was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdTimestamp(Instant createdTimestamp); /** *

* The time when the document was updated. *

* * @param modifiedTimestamp * The time when the document was updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder modifiedTimestamp(Instant modifiedTimestamp); /** *

* The latest version of the document. *

* * @param latestVersionMetadata * The latest version of the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder latestVersionMetadata(DocumentVersionMetadata latestVersionMetadata); /** *

* The latest version of the document. *

* This is a convenience that creates an instance of the {@link DocumentVersionMetadata.Builder} avoiding the * need to create one manually via {@link DocumentVersionMetadata#builder()}. * * When the {@link Consumer} completes, {@link DocumentVersionMetadata.Builder#build()} is called immediately * and its result is passed to {@link #latestVersionMetadata(DocumentVersionMetadata)}. * * @param latestVersionMetadata * a consumer that will call methods on {@link DocumentVersionMetadata.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #latestVersionMetadata(DocumentVersionMetadata) */ default Builder latestVersionMetadata(Consumer latestVersionMetadata) { return latestVersionMetadata(DocumentVersionMetadata.builder().applyMutation(latestVersionMetadata).build()); } /** *

* The resource state. *

* * @param resourceState * The resource state. * @see ResourceStateType * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceStateType */ Builder resourceState(String resourceState); /** *

* The resource state. *

* * @param resourceState * The resource state. * @see ResourceStateType * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceStateType */ Builder resourceState(ResourceStateType resourceState); /** *

* List of labels on the document. *

* * @param labels * List of labels on the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder labels(Collection labels); /** *

* List of labels on the document. *

* * @param labels * List of labels on the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder labels(String... labels); } static final class BuilderImpl implements Builder { private String id; private String creatorId; private String parentFolderId; private Instant createdTimestamp; private Instant modifiedTimestamp; private DocumentVersionMetadata latestVersionMetadata; private String resourceState; private List labels = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(DocumentMetadata model) { id(model.id); creatorId(model.creatorId); parentFolderId(model.parentFolderId); createdTimestamp(model.createdTimestamp); modifiedTimestamp(model.modifiedTimestamp); latestVersionMetadata(model.latestVersionMetadata); resourceState(model.resourceState); labels(model.labels); } public final String getId() { return id; } @Override public final Builder id(String id) { this.id = id; return this; } public final void setId(String id) { this.id = id; } public final String getCreatorId() { return creatorId; } @Override public final Builder creatorId(String creatorId) { this.creatorId = creatorId; return this; } public final void setCreatorId(String creatorId) { this.creatorId = creatorId; } public final String getParentFolderId() { return parentFolderId; } @Override public final Builder parentFolderId(String parentFolderId) { this.parentFolderId = parentFolderId; return this; } public final void setParentFolderId(String parentFolderId) { this.parentFolderId = parentFolderId; } public final Instant getCreatedTimestamp() { return createdTimestamp; } @Override public final Builder createdTimestamp(Instant createdTimestamp) { this.createdTimestamp = createdTimestamp; return this; } public final void setCreatedTimestamp(Instant createdTimestamp) { this.createdTimestamp = createdTimestamp; } public final Instant getModifiedTimestamp() { return modifiedTimestamp; } @Override public final Builder modifiedTimestamp(Instant modifiedTimestamp) { this.modifiedTimestamp = modifiedTimestamp; return this; } public final void setModifiedTimestamp(Instant modifiedTimestamp) { this.modifiedTimestamp = modifiedTimestamp; } public final DocumentVersionMetadata.Builder getLatestVersionMetadata() { return latestVersionMetadata != null ? latestVersionMetadata.toBuilder() : null; } @Override public final Builder latestVersionMetadata(DocumentVersionMetadata latestVersionMetadata) { this.latestVersionMetadata = latestVersionMetadata; return this; } public final void setLatestVersionMetadata(DocumentVersionMetadata.BuilderImpl latestVersionMetadata) { this.latestVersionMetadata = latestVersionMetadata != null ? latestVersionMetadata.build() : null; } public final String getResourceState() { return resourceState; } @Override public final Builder resourceState(String resourceState) { this.resourceState = resourceState; return this; } @Override public final Builder resourceState(ResourceStateType resourceState) { this.resourceState(resourceState == null ? null : resourceState.toString()); return this; } public final void setResourceState(String resourceState) { this.resourceState = resourceState; } public final Collection getLabels() { if (labels instanceof SdkAutoConstructList) { return null; } return labels; } @Override public final Builder labels(Collection labels) { this.labels = SharedLabelsCopier.copy(labels); return this; } @Override @SafeVarargs public final Builder labels(String... labels) { labels(Arrays.asList(labels)); return this; } public final void setLabels(Collection labels) { this.labels = SharedLabelsCopier.copy(labels); } @Override public DocumentMetadata build() { return new DocumentMetadata(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy