# CollectionSchema Class

> Provides for adding/removing/retrieving schema fields in a collection.

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CollectionSchema
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class CollectionSchema
```

**Namespace:** `com::datalogics::PDFL`

## Description

Provides for adding/removing/retrieving schema fields in a collection.

**Referenced by:** [`Collection`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Collection.md)

**Uses types:** [`CollectionSchemaField`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CollectionSchemaField.md)

## Methods

### addField

```java
void com.datalogics.PDFL.CollectionSchema.addField(CollectionSchemaField field)
```

**Parameters**

- `field` ([`CollectionSchemaField`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CollectionSchemaField.md)): CollectionSchemaField object which will be added to the schema.

**Returns:** `void`

AddField allows to set new field to the CollectionSchema object.If the target field exists, it is overwritten. The schema fields contain all information required to organize Collection in a certain way.

### delete

```java
synchronized void com.datalogics.PDFL.CollectionSchema.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.CollectionSchema.delete()
```

**Returns:** `synchronized void`

### finalize

```java
void com.datalogics.PDFL.CollectionSchema.finalize()
```

*protected*

**Returns:** `void`

### getField

```java
CollectionSchemaField com.datalogics.PDFL.CollectionSchema.getField(int idx)
```

**Parameters**

- `idx` (`int`): index of the object to find.

**Returns:** [`CollectionSchemaField`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CollectionSchemaField.md)

CollectionSchemaField object if found or NULL otherwise.

GetField allows to obtain CollectionSchemaField object by its index.

### getField

```java
CollectionSchemaField com.datalogics.PDFL.CollectionSchema.getField(String name)
```

**Parameters**

- `name` (`String`): textual field name.

**Returns:** [`CollectionSchemaField`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CollectionSchemaField.md)

CollectionSchemaField object if found or NULL otherwise.

GetField allows to obtain CollectionSchemaField by name.

### getFieldsNumber

```java
int com.datalogics.PDFL.CollectionSchema.getFieldsNumber()
```

**Returns:** `int`

the fields number.

GetFieldsNumber allows to obtain fields number in the schema.

### removeField

```java
void com.datalogics.PDFL.CollectionSchema.removeField(CollectionSchemaField field)
```

**Parameters**

- `field` ([`CollectionSchemaField`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CollectionSchemaField.md)): CollectionSchemaField which will be removed from the schema.

**Returns:** `void`

RemoveField allows to remove specified field from the schema. NOTE: to distinguish whether specified object belongs to the schema this uses CollectionSchemaField's name.
