Class Bucket.RetentionPolicy.Builder (2.7.1) 
  
      
     
  
  
  
   
  
    
  
  
    
    
    
  Version 2.7.1keyboard_arrow_down  
  
 
    
    
     
    
    
    
    
    
      
  
  
  
    
public   static   final   class  Bucket . RetentionPolicy . Builder   extends   GeneratedMessageV3 . Builder<Bucket . RetentionPolicy . Builder >  implements   Bucket . RetentionPolicyOrBuilder  
   
   Retention policy properties of a bucket.
 Protobuf type google.storage.v2.Bucket.RetentionPolicy
 
  
  
  
  Static Methods
   
   
  getDescriptor() 
  
    
public   static   final   Descriptors . Descriptor   getDescriptor ()  
   
  Returns 
  
  Methods
   
   
  addRepeatedField(Descriptors.FieldDescriptor field, Object value) 
  
    
public   Bucket . RetentionPolicy . Builder   addRepeatedField ( Descriptors . FieldDescriptor   field ,   Object   value )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
   
  build() 
  
    
public   Bucket . RetentionPolicy   build ()  
   
  Returns 
  
   
  buildPartial() 
  
    
public   Bucket . RetentionPolicy   buildPartial ()  
   
  Returns 
  
   
  clear() 
  
    
public   Bucket . RetentionPolicy . Builder   clear ()  
   
  Returns 
  
  Overrides 
  
   
  clearEffectiveTime() 
  
    
public   Bucket . RetentionPolicy . Builder   clearEffectiveTime ()  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Returns 
  
   
  clearField(Descriptors.FieldDescriptor field) 
  
    
public   Bucket . RetentionPolicy . Builder   clearField ( Descriptors . FieldDescriptor   field )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  clearIsLocked() 
  
    
public   Bucket . RetentionPolicy . Builder   clearIsLocked ()  
   
   Once locked, an object retention policy cannot be modified.
 bool is_locked = 2;
 
  Returns 
  
   
  clearOneof(Descriptors.OneofDescriptor oneof) 
  
    
public   Bucket . RetentionPolicy . Builder   clearOneof ( Descriptors . OneofDescriptor   oneof )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  clearRetentionPeriod() 
  
    
public   Bucket . RetentionPolicy . Builder   clearRetentionPeriod ()  
   
   The duration in seconds that objects need to be retained. Retention
 duration must be greater than zero and less than 100 years. Note that
 enforcement of retention periods less than a day is not guaranteed. Such
 periods should only be used for testing purposes.
 int64 retention_period = 3;
 
  Returns 
  
   
  clone() 
  
    
public   Bucket . RetentionPolicy . Builder   clone ()  
   
  Returns 
  
  Overrides 
  
   
  getDefaultInstanceForType() 
  
    
public   Bucket . RetentionPolicy   getDefaultInstanceForType ()  
   
  Returns 
  
   
  getDescriptorForType() 
  
    
public   Descriptors . Descriptor   getDescriptorForType ()  
   
  Returns 
  
  Overrides 
  
   
  getEffectiveTime() 
  
    
public   Timestamp   getEffectiveTime ()  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Returns 
  
    
      
        Type  
        Description  
       
      
        Timestamp  
        The effectiveTime.
 
       
     
  
   
  getEffectiveTimeBuilder() 
  
    
public   Timestamp . Builder   getEffectiveTimeBuilder ()  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Returns 
  
   
  getEffectiveTimeOrBuilder() 
  
    
public   TimestampOrBuilder   getEffectiveTimeOrBuilder ()  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Returns 
  
   
  getIsLocked() 
  
    
public   boolean   getIsLocked ()  
   
   Once locked, an object retention policy cannot be modified.
 bool is_locked = 2;
 
  Returns 
  
    
      
        Type  
        Description  
       
      
        boolean  
        The isLocked.
 
       
     
  
   
  getRetentionPeriod() 
  
    
public   long   getRetentionPeriod ()  
   
   The duration in seconds that objects need to be retained. Retention
 duration must be greater than zero and less than 100 years. Note that
 enforcement of retention periods less than a day is not guaranteed. Such
 periods should only be used for testing purposes.
 int64 retention_period = 3;
 
  Returns 
  
    
      
        Type  
        Description  
       
      
        long  
        The retentionPeriod.
 
       
     
  
   
  hasEffectiveTime() 
  
    
public   boolean   hasEffectiveTime ()  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Returns 
  
    
      
        Type  
        Description  
       
      
        boolean  
        Whether the effectiveTime field is set.
 
       
     
  
   
  internalGetFieldAccessorTable() 
  
    
protected   GeneratedMessageV3 . FieldAccessorTable   internalGetFieldAccessorTable ()  
   
  Returns 
  
  Overrides 
  
   
  isInitialized() 
  
    
public   final   boolean   isInitialized ()  
   
  Returns 
  
  Overrides 
  
   
  mergeEffectiveTime(Timestamp value) 
  
    
public   Bucket . RetentionPolicy . Builder   mergeEffectiveTime ( Timestamp   value )  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Parameter 
  
  Returns 
  
   
  
  
    
public   Bucket . RetentionPolicy . Builder   mergeFrom ( CodedInputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
  Exceptions 
  
   
  mergeFrom(Message other) 
  
    
public   Bucket . RetentionPolicy . Builder   mergeFrom ( Message   other )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  mergeFrom(Bucket.RetentionPolicy other) 
  
    
public   Bucket . RetentionPolicy . Builder   mergeFrom ( Bucket . RetentionPolicy   other )  
   
  Parameter 
  
  Returns 
  
   
  mergeUnknownFields(UnknownFieldSet unknownFields) 
  
    
public   final   Bucket . RetentionPolicy . Builder   mergeUnknownFields ( UnknownFieldSet   unknownFields )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
   
  setEffectiveTime(Timestamp value) 
  
    
public   Bucket . RetentionPolicy . Builder   setEffectiveTime ( Timestamp   value )  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Parameter 
  
  Returns 
  
   
  setEffectiveTime(Timestamp.Builder builderForValue) 
  
    
public   Bucket . RetentionPolicy . Builder   setEffectiveTime ( Timestamp . Builder   builderForValue )  
   
   Server-determined value that indicates the time from which policy was
 enforced and effective.
 .google.protobuf.Timestamp effective_time = 1;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        builderForValue  
        Builder  
       
     
  
  Returns 
  
   
  setField(Descriptors.FieldDescriptor field, Object value) 
  
    
public   Bucket . RetentionPolicy . Builder   setField ( Descriptors . FieldDescriptor   field ,   Object   value )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
   
  setIsLocked(boolean value) 
  
    
public   Bucket . RetentionPolicy . Builder   setIsLocked ( boolean   value )  
   
   Once locked, an object retention policy cannot be modified.
 bool is_locked = 2;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        value  
        boolean The isLocked to set.
 
       
     
  
  Returns 
  
   
  setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value) 
  
    
public   Bucket . RetentionPolicy . Builder   setRepeatedField ( Descriptors . FieldDescriptor   field ,   int   index ,   Object   value )  
   
  Parameters 
  
  Returns 
  
  Overrides 
  
   
  setRetentionPeriod(long value) 
  
    
public   Bucket . RetentionPolicy . Builder   setRetentionPeriod ( long   value )  
   
   The duration in seconds that objects need to be retained. Retention
 duration must be greater than zero and less than 100 years. Note that
 enforcement of retention periods less than a day is not guaranteed. Such
 periods should only be used for testing purposes.
 int64 retention_period = 3;
 
  Parameter 
  
    
      
        Name  
        Description  
       
      
        value  
        long The retentionPeriod to set.
 
       
     
  
  Returns 
  
   
  setUnknownFields(UnknownFieldSet unknownFields) 
  
    
public   final   Bucket . RetentionPolicy . Builder   setUnknownFields ( UnknownFieldSet   unknownFields )  
   
  Parameter 
  
  Returns 
  
  Overrides 
  
 
     
    
  
  
  
     
  
 
  
    
    
      
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-30 UTC.
 
 
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-30 UTC."],[],[]]