# Class GCRules (2.79.0)

2.79.0 (latest) 2.78.1 2.77.0 2.74.0 2.73.0 2.72.0 2.71.0 2.70.0 2.68.0 2.67.1 2.66.0 2.65.1 2.63.0 2.62.0 2.61.0 2.60.0 2.59.0 2.58.2 2.56.0 2.54.0 2.52.0 2.51.2 2.49.0 2.46.0 2.45.1 2.44.1 2.43.0 2.42.0 2.40.0 2.39.5 2.37.0 2.35.1 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.1 2.28.0

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

    public final class GCRules

Wraps GcRule protocol buffer object and exposes a friendly API.

Note: Garbage collection executes opportunistically in the background, and so it's possible
for reads to return a cell even if it matches the active GC expression for its family. Please use
appropriate filters in your reads to exclude cells which are eligible for garbage collection.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> GCRules

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Fields

### GCRULES

    public static final GCRules GCRULES

Factory method to create GCRules - entry point into the DSL.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules` |   |

## Methods

### defaultRule()

    public GCRules.DefaultRule defaultRule()

Creates an empty default rule

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules.DefaultRule` |   |

### fromProto(GcRule source)

    public GCRules.GCRule fromProto(GcRule source)

> [!WARNING]
> **Internal Only**: This feature is not stable for application use.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `source` | `com.google.bigtable.admin.v2.GcRule` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules.GCRule` |   |

### intersection()

    public GCRules.IntersectionRule intersection()

Creates a new instance of the IntersectionRule

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules.IntersectionRule` |   |

### maxAge(long maxAge, TimeUnit timeUnit)

    public GCRules.DurationRule maxAge(long maxAge, TimeUnit timeUnit)

Creates a new instance of the DurationRule

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `maxAge` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` - maximum age of the cell to keep |
| `timeUnit` | `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html` - timeunit for the age |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules.DurationRule` |   |

### maxAge(Duration duration)

    public GCRules.DurationRule maxAge(Duration duration)

Creates a new instance of the DurationRule

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `duration` | `org.threeten.bp.Duration` - age expressed as duration |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules.DurationRule` |   |

### maxVersions(int maxVersion)

    public GCRules.VersionRule maxVersions(int maxVersion)

Creates a new instance of the VersionRule

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `maxVersion` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` - maximum number of cell versions to keep |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules.VersionRule` |   |

### union()

    public GCRules.UnionRule union()

Creates a new instance of the IntersectionRule

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.admin.v2.models.GCRules.UnionRule` |   |