Class BetaEnvironment.Config
-
- All Implemented Interfaces:
public final class BetaEnvironment.ConfigEnvironment configuration (either Anthropic Cloud or self-hosted)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaEnvironment.Config.VisitorAn interface that defines how to map each variant of Config to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<BetaCloudConfig>cloud()cloudenvironment configuration.final Optional<BetaSelfHostedConfig>selfHosted()Configuration for self-hosted environments. final BooleanisCloud()final BooleanisSelfHosted()final BetaCloudConfigasCloud()cloudenvironment configuration.final BetaSelfHostedConfigasSelfHosted()Configuration for self-hosted environments. final Optional<JsonValue>_json()final <T extends Any> Taccept(BetaEnvironment.Config.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaEnvironment.Configvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaEnvironment.ConfigofCloud(BetaCloudConfig cloud)cloudenvironment configuration.final static BetaEnvironment.ConfigofSelfHosted(BetaSelfHostedConfig selfHosted)Configuration for self-hosted environments. -
-
Method Detail
-
cloud
final Optional<BetaCloudConfig> cloud()
cloudenvironment configuration.
-
selfHosted
final Optional<BetaSelfHostedConfig> selfHosted()
Configuration for self-hosted environments.
-
isSelfHosted
final Boolean isSelfHosted()
-
asCloud
final BetaCloudConfig asCloud()
cloudenvironment configuration.
-
asSelfHosted
final BetaSelfHostedConfig asSelfHosted()
Configuration for self-hosted environments.
-
accept
final <T extends Any> T accept(BetaEnvironment.Config.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = config.accept(new Config.Visitor<Optional<String>>() { @Override public Optional<String> visitCloud(BetaCloudConfig cloud) { return Optional.of(cloud.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaEnvironment.Config validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofCloud
final static BetaEnvironment.Config ofCloud(BetaCloudConfig cloud)
cloudenvironment configuration.
-
ofSelfHosted
final static BetaEnvironment.Config ofSelfHosted(BetaSelfHostedConfig selfHosted)
Configuration for self-hosted environments.
-
-
-
-