001/* 002 * Copyright 2024 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.proactiveconnect; 017 018import com.fasterxml.jackson.annotation.JsonProperty; 019import com.vonage.client.JsonableBaseObject; 020 021/** 022 * Represents a Proactive Connect list's {@code attributes} property. 023 */ 024public class ListAttribute extends JsonableBaseObject { 025 private String alias, name; 026 private Boolean key; 027 028 protected ListAttribute() { 029 } 030 031 ListAttribute(Builder builder) { 032 alias = builder.alias; 033 name = builder.name; 034 key = builder.key; 035 } 036 037 /** 038 * Alternative name to use for this attribute. Use when you wish to correlate between 2 or more lists 039 * that are using different attribute names for the same semantic data. 040 * 041 * @return The attribute alias or {@code null} if unset. 042 */ 043 @JsonProperty("alias") 044 public String getAlias() { 045 return alias; 046 } 047 048 /** 049 * List attribute name. 050 * 051 * @return The attribute name or {@code null} if unset. 052 */ 053 @JsonProperty("name") 054 public String getName() { 055 return name; 056 } 057 058 /** 059 * Will be {@code true} if this attribute should be used to correlate between 2 or more lists. 060 * 061 * @return Whether this attribute is used as a key, or {@code null} if unknown. 062 */ 063 @JsonProperty("key") 064 public Boolean getKey() { 065 return key; 066 } 067 068 /** 069 * Entry point for constructing an instance of this class. 070 * 071 * @return A new Builder. 072 */ 073 public static Builder builder() { 074 return new Builder(); 075 } 076 077 public static class Builder { 078 protected String name, alias; 079 protected Boolean key; 080 081 Builder() {} 082 083 /** 084 * Sets the list attribute name. 085 * 086 * @param name The name. 087 * 088 * @return This builder. 089 */ 090 public Builder name(String name) { 091 this.name = name; 092 return this; 093 } 094 095 /** 096 * Sets the list attribute alias. 097 * 098 * @param alias The alias. 099 * 100 * @return This builder. 101 */ 102 public Builder alias(String alias) { 103 this.alias = alias; 104 return this; 105 } 106 107 /** 108 * Set to {@code true} if this attribute should be used to correlate between 2 or more lists. 109 * 110 * @param key Whether this attribute is used as a key. 111 * 112 * @return This builder. 113 */ 114 public Builder key(boolean key) { 115 this.key = key; 116 return this; 117 } 118 119 /** 120 * Builds the list attribute object. 121 * 122 * @return A new ListAttribute with this builder's properties. 123 */ 124 public ListAttribute build() { 125 return new ListAttribute(this); 126 } 127 } 128}