> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canton.network/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# ContractCompanion

> Metadata and utilities associated with a template as a whole, rather than one single contract made from that template. Application code should not instantiate or subclass; instead, refer to the COMPANION field on generated Template subclasses. All protected members herein are considered part of the INTERNAL API. Every instance is either a ContractCompanion.WithKey or ContractCompanion.WithoutKey, depending on whether the template defined a key type. ContractCompanion.WithKey defines extra utilities for working with contract keys.

[Back to package](./index)

com.daml.ledger.javaapi.data.codegen

# ContractCompanion

Metadata and utilities associated with a template as a whole, rather than one single contract made from that template. Application code should not instantiate or subclass; instead, refer to the COMPANION field on generated Template subclasses. All protected members herein are considered part of the INTERNAL API. Every instance is either a ContractCompanion.WithKey or ContractCompanion.WithoutKey, depending on whether the template defined a key type. ContractCompanion.WithKey defines extra utilities for working with contract keys.

Java

Package
com.daml.ledger.javaapi.data.codegen

Upstream docs
[Open Javadoc](https://javadoc.io/doc/com.daml/bindings-java/3.7.5/com/daml/ledger/javaapi/data/codegen/ContractCompanion.html)

## Signature

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
public abstract class ContractCompanion<Ct,Id,Data> extends ContractTypeCompanion<Ct,Id,Data,Data>
```

## Members

| Member | Lifecycle | Upstream docs |
| - | - | - |
| `fromJson` | - | [Open](https://javadoc.io/doc/com.daml/bindings-java/3.7.5/com/daml/ledger/javaapi/data/codegen/ContractCompanion.html#fromJson) |
| `fromJson(String)` | - | [Open](https://javadoc.io/doc/com.daml/bindings-java/3.7.5/com/daml/ledger/javaapi/data/codegen/ContractCompanion.html#fromJson%28java.lang.String%29) |
| `getValueDecoder()` | Added `3.5.1` | [Open](https://javadoc.io/doc/com.daml/bindings-java/3.7.5/com/daml/ledger/javaapi/data/codegen/ContractCompanion.html#getValueDecoder%28%29) |
| `valueDecoder(ContractCompanion<?, ? extends ContractId<Data>, Data>)` | - | [Open](https://javadoc.io/doc/com.daml/bindings-java/3.7.5/com/daml/ledger/javaapi/data/codegen/ContractCompanion.html#valueDecoder%28com.daml.ledger.javaapi.data.codegen.ContractCompanion%29) |
