All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.acmpca.model.ASN1Subject Maven / Gradle / Ivy

Go to download

The AWS Java SDK for ACM PCA module holds the client classes that are used for communicating with ACM PCA.

There is a newer version: 2.28.4
Show newest version
/*
 * 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.services.acmpca.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Contains information about the certificate subject. The Subject field in the certificate identifies the * entity that owns or controls the public key in the certificate. The entity can be a user, computer, device, or * service. The Subject must contain an X.500 distinguished name (DN). A DN is a sequence of relative * distinguished names (RDNs). The RDNs are separated by commas in the certificate. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ASN1Subject implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField COUNTRY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Country") .getter(getter(ASN1Subject::country)).setter(setter(Builder::country)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Country").build()).build(); private static final SdkField ORGANIZATION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Organization").getter(getter(ASN1Subject::organization)).setter(setter(Builder::organization)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Organization").build()).build(); private static final SdkField ORGANIZATIONAL_UNIT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("OrganizationalUnit").getter(getter(ASN1Subject::organizationalUnit)) .setter(setter(Builder::organizationalUnit)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrganizationalUnit").build()) .build(); private static final SdkField DISTINGUISHED_NAME_QUALIFIER_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("DistinguishedNameQualifier") .getter(getter(ASN1Subject::distinguishedNameQualifier)) .setter(setter(Builder::distinguishedNameQualifier)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DistinguishedNameQualifier").build()) .build(); private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State") .getter(getter(ASN1Subject::state)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build(); private static final SdkField COMMON_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("CommonName").getter(getter(ASN1Subject::commonName)).setter(setter(Builder::commonName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CommonName").build()).build(); private static final SdkField SERIAL_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SerialNumber").getter(getter(ASN1Subject::serialNumber)).setter(setter(Builder::serialNumber)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SerialNumber").build()).build(); private static final SdkField LOCALITY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Locality").getter(getter(ASN1Subject::locality)).setter(setter(Builder::locality)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Locality").build()).build(); private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Title") .getter(getter(ASN1Subject::title)).setter(setter(Builder::title)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Title").build()).build(); private static final SdkField SURNAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Surname") .getter(getter(ASN1Subject::surname)).setter(setter(Builder::surname)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Surname").build()).build(); private static final SdkField GIVEN_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("GivenName").getter(getter(ASN1Subject::givenName)).setter(setter(Builder::givenName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GivenName").build()).build(); private static final SdkField INITIALS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Initials").getter(getter(ASN1Subject::initials)).setter(setter(Builder::initials)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Initials").build()).build(); private static final SdkField PSEUDONYM_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Pseudonym").getter(getter(ASN1Subject::pseudonym)).setter(setter(Builder::pseudonym)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Pseudonym").build()).build(); private static final SdkField GENERATION_QUALIFIER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("GenerationQualifier").getter(getter(ASN1Subject::generationQualifier)) .setter(setter(Builder::generationQualifier)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GenerationQualifier").build()) .build(); private static final SdkField> CUSTOM_ATTRIBUTES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("CustomAttributes") .getter(getter(ASN1Subject::customAttributes)) .setter(setter(Builder::customAttributes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomAttributes").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(CustomAttribute::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COUNTRY_FIELD, ORGANIZATION_FIELD, ORGANIZATIONAL_UNIT_FIELD, DISTINGUISHED_NAME_QUALIFIER_FIELD, STATE_FIELD, COMMON_NAME_FIELD, SERIAL_NUMBER_FIELD, LOCALITY_FIELD, TITLE_FIELD, SURNAME_FIELD, GIVEN_NAME_FIELD, INITIALS_FIELD, PSEUDONYM_FIELD, GENERATION_QUALIFIER_FIELD, CUSTOM_ATTRIBUTES_FIELD)); private static final long serialVersionUID = 1L; private final String country; private final String organization; private final String organizationalUnit; private final String distinguishedNameQualifier; private final String state; private final String commonName; private final String serialNumber; private final String locality; private final String title; private final String surname; private final String givenName; private final String initials; private final String pseudonym; private final String generationQualifier; private final List customAttributes; private ASN1Subject(BuilderImpl builder) { this.country = builder.country; this.organization = builder.organization; this.organizationalUnit = builder.organizationalUnit; this.distinguishedNameQualifier = builder.distinguishedNameQualifier; this.state = builder.state; this.commonName = builder.commonName; this.serialNumber = builder.serialNumber; this.locality = builder.locality; this.title = builder.title; this.surname = builder.surname; this.givenName = builder.givenName; this.initials = builder.initials; this.pseudonym = builder.pseudonym; this.generationQualifier = builder.generationQualifier; this.customAttributes = builder.customAttributes; } /** *

* Two-digit code that specifies the country in which the certificate subject located. *

* * @return Two-digit code that specifies the country in which the certificate subject located. */ public final String country() { return country; } /** *

* Legal name of the organization with which the certificate subject is affiliated. *

* * @return Legal name of the organization with which the certificate subject is affiliated. */ public final String organization() { return organization; } /** *

* A subdivision or unit of the organization (such as sales or finance) with which the certificate subject is * affiliated. *

* * @return A subdivision or unit of the organization (such as sales or finance) with which the certificate subject * is affiliated. */ public final String organizationalUnit() { return organizationalUnit; } /** *

* Disambiguating information for the certificate subject. *

* * @return Disambiguating information for the certificate subject. */ public final String distinguishedNameQualifier() { return distinguishedNameQualifier; } /** *

* State in which the subject of the certificate is located. *

* * @return State in which the subject of the certificate is located. */ public final String state() { return state; } /** *

* For CA and end-entity certificates in a private PKI, the common name (CN) can be any string within the length * limit. *

*

* Note: In publicly trusted certificates, the common name must be a fully qualified domain name (FQDN) associated * with the certificate subject. *

* * @return For CA and end-entity certificates in a private PKI, the common name (CN) can be any string within the * length limit.

*

* Note: In publicly trusted certificates, the common name must be a fully qualified domain name (FQDN) * associated with the certificate subject. */ public final String commonName() { return commonName; } /** *

* The certificate serial number. *

* * @return The certificate serial number. */ public final String serialNumber() { return serialNumber; } /** *

* The locality (such as a city or town) in which the certificate subject is located. *

* * @return The locality (such as a city or town) in which the certificate subject is located. */ public final String locality() { return locality; } /** *

* A title such as Mr. or Ms., which is pre-pended to the name to refer formally to the certificate subject. *

* * @return A title such as Mr. or Ms., which is pre-pended to the name to refer formally to the certificate subject. */ public final String title() { return title; } /** *

* Family name. In the US and the UK, for example, the surname of an individual is ordered last. In Asian cultures * the surname is typically ordered first. *

* * @return Family name. In the US and the UK, for example, the surname of an individual is ordered last. In Asian * cultures the surname is typically ordered first. */ public final String surname() { return surname; } /** *

* First name. *

* * @return First name. */ public final String givenName() { return givenName; } /** *

* Concatenation that typically contains the first letter of the GivenName, the first letter of the middle * name if one exists, and the first letter of the Surname. *

* * @return Concatenation that typically contains the first letter of the GivenName, the first letter of the * middle name if one exists, and the first letter of the Surname. */ public final String initials() { return initials; } /** *

* Typically a shortened version of a longer GivenName. For example, Jonathan is often shortened to John. * Elizabeth is often shortened to Beth, Liz, or Eliza. *

* * @return Typically a shortened version of a longer GivenName. For example, Jonathan is often shortened to * John. Elizabeth is often shortened to Beth, Liz, or Eliza. */ public final String pseudonym() { return pseudonym; } /** *

* Typically a qualifier appended to the name of an individual. Examples include Jr. for junior, Sr. for senior, and * III for third. *

* * @return Typically a qualifier appended to the name of an individual. Examples include Jr. for junior, Sr. for * senior, and III for third. */ public final String generationQualifier() { return generationQualifier; } /** * For responses, this returns true if the service returned a value for the CustomAttributes property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasCustomAttributes() { return customAttributes != null && !(customAttributes instanceof SdkAutoConstructList); } /** *

*

* Contains a sequence of one or more X.500 relative distinguished names (RDNs), each of which consists of an object * identifier (OID) and a value. For more information, see NIST’s definition of Object Identifier (OID). *

* *

* Custom attributes cannot be used in combination with standard attributes. *

*
*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasCustomAttributes} method. *

* * @return

* Contains a sequence of one or more X.500 relative distinguished names (RDNs), each of which consists of * an object identifier (OID) and a value. For more information, see NIST’s definition of Object Identifier (OID). *

* *

* Custom attributes cannot be used in combination with standard attributes. *

*/ public final List customAttributes() { return customAttributes; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(country()); hashCode = 31 * hashCode + Objects.hashCode(organization()); hashCode = 31 * hashCode + Objects.hashCode(organizationalUnit()); hashCode = 31 * hashCode + Objects.hashCode(distinguishedNameQualifier()); hashCode = 31 * hashCode + Objects.hashCode(state()); hashCode = 31 * hashCode + Objects.hashCode(commonName()); hashCode = 31 * hashCode + Objects.hashCode(serialNumber()); hashCode = 31 * hashCode + Objects.hashCode(locality()); hashCode = 31 * hashCode + Objects.hashCode(title()); hashCode = 31 * hashCode + Objects.hashCode(surname()); hashCode = 31 * hashCode + Objects.hashCode(givenName()); hashCode = 31 * hashCode + Objects.hashCode(initials()); hashCode = 31 * hashCode + Objects.hashCode(pseudonym()); hashCode = 31 * hashCode + Objects.hashCode(generationQualifier()); hashCode = 31 * hashCode + Objects.hashCode(hasCustomAttributes() ? customAttributes() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ASN1Subject)) { return false; } ASN1Subject other = (ASN1Subject) obj; return Objects.equals(country(), other.country()) && Objects.equals(organization(), other.organization()) && Objects.equals(organizationalUnit(), other.organizationalUnit()) && Objects.equals(distinguishedNameQualifier(), other.distinguishedNameQualifier()) && Objects.equals(state(), other.state()) && Objects.equals(commonName(), other.commonName()) && Objects.equals(serialNumber(), other.serialNumber()) && Objects.equals(locality(), other.locality()) && Objects.equals(title(), other.title()) && Objects.equals(surname(), other.surname()) && Objects.equals(givenName(), other.givenName()) && Objects.equals(initials(), other.initials()) && Objects.equals(pseudonym(), other.pseudonym()) && Objects.equals(generationQualifier(), other.generationQualifier()) && hasCustomAttributes() == other.hasCustomAttributes() && Objects.equals(customAttributes(), other.customAttributes()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("ASN1Subject").add("Country", country()).add("Organization", organization()) .add("OrganizationalUnit", organizationalUnit()).add("DistinguishedNameQualifier", distinguishedNameQualifier()) .add("State", state()).add("CommonName", commonName()).add("SerialNumber", serialNumber()) .add("Locality", locality()).add("Title", title()).add("Surname", surname()).add("GivenName", givenName()) .add("Initials", initials()).add("Pseudonym", pseudonym()).add("GenerationQualifier", generationQualifier()) .add("CustomAttributes", hasCustomAttributes() ? customAttributes() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Country": return Optional.ofNullable(clazz.cast(country())); case "Organization": return Optional.ofNullable(clazz.cast(organization())); case "OrganizationalUnit": return Optional.ofNullable(clazz.cast(organizationalUnit())); case "DistinguishedNameQualifier": return Optional.ofNullable(clazz.cast(distinguishedNameQualifier())); case "State": return Optional.ofNullable(clazz.cast(state())); case "CommonName": return Optional.ofNullable(clazz.cast(commonName())); case "SerialNumber": return Optional.ofNullable(clazz.cast(serialNumber())); case "Locality": return Optional.ofNullable(clazz.cast(locality())); case "Title": return Optional.ofNullable(clazz.cast(title())); case "Surname": return Optional.ofNullable(clazz.cast(surname())); case "GivenName": return Optional.ofNullable(clazz.cast(givenName())); case "Initials": return Optional.ofNullable(clazz.cast(initials())); case "Pseudonym": return Optional.ofNullable(clazz.cast(pseudonym())); case "GenerationQualifier": return Optional.ofNullable(clazz.cast(generationQualifier())); case "CustomAttributes": return Optional.ofNullable(clazz.cast(customAttributes())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ASN1Subject) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Two-digit code that specifies the country in which the certificate subject located. *

* * @param country * Two-digit code that specifies the country in which the certificate subject located. * @return Returns a reference to this object so that method calls can be chained together. */ Builder country(String country); /** *

* Legal name of the organization with which the certificate subject is affiliated. *

* * @param organization * Legal name of the organization with which the certificate subject is affiliated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder organization(String organization); /** *

* A subdivision or unit of the organization (such as sales or finance) with which the certificate subject is * affiliated. *

* * @param organizationalUnit * A subdivision or unit of the organization (such as sales or finance) with which the certificate * subject is affiliated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder organizationalUnit(String organizationalUnit); /** *

* Disambiguating information for the certificate subject. *

* * @param distinguishedNameQualifier * Disambiguating information for the certificate subject. * @return Returns a reference to this object so that method calls can be chained together. */ Builder distinguishedNameQualifier(String distinguishedNameQualifier); /** *

* State in which the subject of the certificate is located. *

* * @param state * State in which the subject of the certificate is located. * @return Returns a reference to this object so that method calls can be chained together. */ Builder state(String state); /** *

* For CA and end-entity certificates in a private PKI, the common name (CN) can be any string within the length * limit. *

*

* Note: In publicly trusted certificates, the common name must be a fully qualified domain name (FQDN) * associated with the certificate subject. *

* * @param commonName * For CA and end-entity certificates in a private PKI, the common name (CN) can be any string within the * length limit.

*

* Note: In publicly trusted certificates, the common name must be a fully qualified domain name (FQDN) * associated with the certificate subject. * @return Returns a reference to this object so that method calls can be chained together. */ Builder commonName(String commonName); /** *

* The certificate serial number. *

* * @param serialNumber * The certificate serial number. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serialNumber(String serialNumber); /** *

* The locality (such as a city or town) in which the certificate subject is located. *

* * @param locality * The locality (such as a city or town) in which the certificate subject is located. * @return Returns a reference to this object so that method calls can be chained together. */ Builder locality(String locality); /** *

* A title such as Mr. or Ms., which is pre-pended to the name to refer formally to the certificate subject. *

* * @param title * A title such as Mr. or Ms., which is pre-pended to the name to refer formally to the certificate * subject. * @return Returns a reference to this object so that method calls can be chained together. */ Builder title(String title); /** *

* Family name. In the US and the UK, for example, the surname of an individual is ordered last. In Asian * cultures the surname is typically ordered first. *

* * @param surname * Family name. In the US and the UK, for example, the surname of an individual is ordered last. In Asian * cultures the surname is typically ordered first. * @return Returns a reference to this object so that method calls can be chained together. */ Builder surname(String surname); /** *

* First name. *

* * @param givenName * First name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder givenName(String givenName); /** *

* Concatenation that typically contains the first letter of the GivenName, the first letter of the * middle name if one exists, and the first letter of the Surname. *

* * @param initials * Concatenation that typically contains the first letter of the GivenName, the first letter of * the middle name if one exists, and the first letter of the Surname. * @return Returns a reference to this object so that method calls can be chained together. */ Builder initials(String initials); /** *

* Typically a shortened version of a longer GivenName. For example, Jonathan is often shortened to John. * Elizabeth is often shortened to Beth, Liz, or Eliza. *

* * @param pseudonym * Typically a shortened version of a longer GivenName. For example, Jonathan is often shortened * to John. Elizabeth is often shortened to Beth, Liz, or Eliza. * @return Returns a reference to this object so that method calls can be chained together. */ Builder pseudonym(String pseudonym); /** *

* Typically a qualifier appended to the name of an individual. Examples include Jr. for junior, Sr. for senior, * and III for third. *

* * @param generationQualifier * Typically a qualifier appended to the name of an individual. Examples include Jr. for junior, Sr. for * senior, and III for third. * @return Returns a reference to this object so that method calls can be chained together. */ Builder generationQualifier(String generationQualifier); /** *

*

* Contains a sequence of one or more X.500 relative distinguished names (RDNs), each of which consists of an * object identifier (OID) and a value. For more information, see NIST’s definition of Object Identifier (OID). *

* *

* Custom attributes cannot be used in combination with standard attributes. *

*
* * @param customAttributes *

* Contains a sequence of one or more X.500 relative distinguished names (RDNs), each of which consists * of an object identifier (OID) and a value. For more information, see NIST’s definition of Object Identifier (OID). *

* *

* Custom attributes cannot be used in combination with standard attributes. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder customAttributes(Collection customAttributes); /** *

*

* Contains a sequence of one or more X.500 relative distinguished names (RDNs), each of which consists of an * object identifier (OID) and a value. For more information, see NIST’s definition of Object Identifier (OID). *

* *

* Custom attributes cannot be used in combination with standard attributes. *

*
* * @param customAttributes *

* Contains a sequence of one or more X.500 relative distinguished names (RDNs), each of which consists * of an object identifier (OID) and a value. For more information, see NIST’s definition of Object Identifier (OID). *

* *

* Custom attributes cannot be used in combination with standard attributes. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder customAttributes(CustomAttribute... customAttributes); /** *

*

* Contains a sequence of one or more X.500 relative distinguished names (RDNs), each of which consists of an * object identifier (OID) and a value. For more information, see NIST’s definition of Object Identifier (OID). *

* *

* Custom attributes cannot be used in combination with standard attributes. *

*
This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.acmpca.model.CustomAttribute.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.acmpca.model.CustomAttribute#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.acmpca.model.CustomAttribute.Builder#build()} is called immediately * and its result is passed to {@link #customAttributes(List)}. * * @param customAttributes * a consumer that will call methods on * {@link software.amazon.awssdk.services.acmpca.model.CustomAttribute.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #customAttributes(java.util.Collection) */ Builder customAttributes(Consumer... customAttributes); } static final class BuilderImpl implements Builder { private String country; private String organization; private String organizationalUnit; private String distinguishedNameQualifier; private String state; private String commonName; private String serialNumber; private String locality; private String title; private String surname; private String givenName; private String initials; private String pseudonym; private String generationQualifier; private List customAttributes = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ASN1Subject model) { country(model.country); organization(model.organization); organizationalUnit(model.organizationalUnit); distinguishedNameQualifier(model.distinguishedNameQualifier); state(model.state); commonName(model.commonName); serialNumber(model.serialNumber); locality(model.locality); title(model.title); surname(model.surname); givenName(model.givenName); initials(model.initials); pseudonym(model.pseudonym); generationQualifier(model.generationQualifier); customAttributes(model.customAttributes); } public final String getCountry() { return country; } public final void setCountry(String country) { this.country = country; } @Override public final Builder country(String country) { this.country = country; return this; } public final String getOrganization() { return organization; } public final void setOrganization(String organization) { this.organization = organization; } @Override public final Builder organization(String organization) { this.organization = organization; return this; } public final String getOrganizationalUnit() { return organizationalUnit; } public final void setOrganizationalUnit(String organizationalUnit) { this.organizationalUnit = organizationalUnit; } @Override public final Builder organizationalUnit(String organizationalUnit) { this.organizationalUnit = organizationalUnit; return this; } public final String getDistinguishedNameQualifier() { return distinguishedNameQualifier; } public final void setDistinguishedNameQualifier(String distinguishedNameQualifier) { this.distinguishedNameQualifier = distinguishedNameQualifier; } @Override public final Builder distinguishedNameQualifier(String distinguishedNameQualifier) { this.distinguishedNameQualifier = distinguishedNameQualifier; return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } public final String getCommonName() { return commonName; } public final void setCommonName(String commonName) { this.commonName = commonName; } @Override public final Builder commonName(String commonName) { this.commonName = commonName; return this; } public final String getSerialNumber() { return serialNumber; } public final void setSerialNumber(String serialNumber) { this.serialNumber = serialNumber; } @Override public final Builder serialNumber(String serialNumber) { this.serialNumber = serialNumber; return this; } public final String getLocality() { return locality; } public final void setLocality(String locality) { this.locality = locality; } @Override public final Builder locality(String locality) { this.locality = locality; return this; } public final String getTitle() { return title; } public final void setTitle(String title) { this.title = title; } @Override public final Builder title(String title) { this.title = title; return this; } public final String getSurname() { return surname; } public final void setSurname(String surname) { this.surname = surname; } @Override public final Builder surname(String surname) { this.surname = surname; return this; } public final String getGivenName() { return givenName; } public final void setGivenName(String givenName) { this.givenName = givenName; } @Override public final Builder givenName(String givenName) { this.givenName = givenName; return this; } public final String getInitials() { return initials; } public final void setInitials(String initials) { this.initials = initials; } @Override public final Builder initials(String initials) { this.initials = initials; return this; } public final String getPseudonym() { return pseudonym; } public final void setPseudonym(String pseudonym) { this.pseudonym = pseudonym; } @Override public final Builder pseudonym(String pseudonym) { this.pseudonym = pseudonym; return this; } public final String getGenerationQualifier() { return generationQualifier; } public final void setGenerationQualifier(String generationQualifier) { this.generationQualifier = generationQualifier; } @Override public final Builder generationQualifier(String generationQualifier) { this.generationQualifier = generationQualifier; return this; } public final List getCustomAttributes() { List result = CustomAttributeListCopier.copyToBuilder(this.customAttributes); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setCustomAttributes(Collection customAttributes) { this.customAttributes = CustomAttributeListCopier.copyFromBuilder(customAttributes); } @Override public final Builder customAttributes(Collection customAttributes) { this.customAttributes = CustomAttributeListCopier.copy(customAttributes); return this; } @Override @SafeVarargs public final Builder customAttributes(CustomAttribute... customAttributes) { customAttributes(Arrays.asList(customAttributes)); return this; } @Override @SafeVarargs public final Builder customAttributes(Consumer... customAttributes) { customAttributes(Stream.of(customAttributes).map(c -> CustomAttribute.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public ASN1Subject build() { return new ASN1Subject(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy