
software.amazon.awssdk.codegen.poet.auth.scheme.AuthSchemeCodegenMetadata Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package software.amazon.awssdk.codegen.poet.auth.scheme;
import com.squareup.javapoet.CodeBlock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Supplier;
import software.amazon.awssdk.utils.Validate;
/**
* Represents a modeled auth scheme option.
*/
public final class AuthSchemeCodegenMetadata {
private final String schemeId;
private final List properties;
private final Class> authSchemeClass;
private AuthSchemeCodegenMetadata(Builder builder) {
this.schemeId = Validate.paramNotNull(builder.schemeId, "schemeId");
this.properties = Collections.unmodifiableList(Validate.paramNotNull(builder.properties, "properties"));
this.authSchemeClass = Validate.paramNotNull(builder.authSchemeClass, "authSchemeClass");
}
public String schemeId() {
return schemeId;
}
public Class> authSchemeClass() {
return authSchemeClass;
}
public List properties() {
return properties;
}
public Builder toBuilder() {
return new Builder(this);
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String schemeId;
private List properties = new ArrayList<>();
private Class> authSchemeClass;
Builder() {
}
Builder(AuthSchemeCodegenMetadata other) {
this.schemeId = other.schemeId;
this.properties.addAll(other.properties);
this.authSchemeClass = other.authSchemeClass;
}
public Builder schemeId(String schemeId) {
this.schemeId = schemeId;
return this;
}
public Builder addProperty(SignerPropertyValueProvider property) {
this.properties.add(property);
return this;
}
public Builder properties(List properties) {
this.properties.clear();
this.properties.addAll(properties);
return this;
}
public Builder authSchemeClass(Class> authSchemeClass) {
this.authSchemeClass = authSchemeClass;
return this;
}
public AuthSchemeCodegenMetadata build() {
return new AuthSchemeCodegenMetadata(this);
}
}
static class SignerPropertyValueProvider {
private final Class> containingClass;
private final String fieldName;
private final BiConsumer valueEmitter;
private final Supplier
© 2015 - 2025 Weber Informatics LLC | Privacy Policy