1 package de.softwareforge.testing.postgres.embedded; 2 3 import com.google.common.collect.ImmutableMap; 4 import jakarta.annotation.Nonnull; 5 import java.sql.SQLException; 6 import java.util.Optional; 7 import javax.annotation.processing.Generated; 8 9 @Generated("com.google.auto.value.processor.AutoValueProcessor") 10 final class AutoValue_DatabaseInfo extends DatabaseInfo { 11 12 private final String dbName; 13 14 private final int port; 15 16 private final String user; 17 18 private final ImmutableMap<String, String> connectionProperties; 19 20 private final Optional<SQLException> exception; 21 22 private AutoValue_DatabaseInfo( 23 String dbName, 24 int port, 25 String user, 26 ImmutableMap<String, String> connectionProperties, 27 Optional<SQLException> exception) { 28 this.dbName = dbName; 29 this.port = port; 30 this.user = user; 31 this.connectionProperties = connectionProperties; 32 this.exception = exception; 33 } 34 35 @Nonnull 36 @Override 37 public String dbName() { 38 return dbName; 39 } 40 41 @Override 42 public int port() { 43 return port; 44 } 45 46 @Nonnull 47 @Override 48 public String user() { 49 return user; 50 } 51 52 @Nonnull 53 @Override 54 public ImmutableMap<String, String> connectionProperties() { 55 return connectionProperties; 56 } 57 58 @Nonnull 59 @Override 60 Optional<SQLException> exception() { 61 return exception; 62 } 63 64 @Override 65 public String toString() { 66 return "DatabaseInfo{" 67 + "dbName=" + dbName + ", " 68 + "port=" + port + ", " 69 + "user=" + user + ", " 70 + "connectionProperties=" + connectionProperties + ", " 71 + "exception=" + exception 72 + "}"; 73 } 74 75 @Override 76 public boolean equals(Object o) { 77 if (o == this) { 78 return true; 79 } 80 if (o instanceof DatabaseInfo) { 81 DatabaseInfo that = (DatabaseInfo) o; 82 return this.dbName.equals(that.dbName()) 83 && this.port == that.port() 84 && this.user.equals(that.user()) 85 && this.connectionProperties.equals(that.connectionProperties()) 86 && this.exception.equals(that.exception()); 87 } 88 return false; 89 } 90 91 @Override 92 public int hashCode() { 93 int h$ = 1; 94 h$ *= 1000003; 95 h$ ^= dbName.hashCode(); 96 h$ *= 1000003; 97 h$ ^= port; 98 h$ *= 1000003; 99 h$ ^= user.hashCode(); 100 h$ *= 1000003; 101 h$ ^= connectionProperties.hashCode(); 102 h$ *= 1000003; 103 h$ ^= exception.hashCode(); 104 return h$; 105 } 106 107 static final class Builder extends DatabaseInfo.Builder { 108 private String dbName; 109 private int port; 110 private String user; 111 private ImmutableMap.Builder<String, String> connectionPropertiesBuilder$; 112 private ImmutableMap<String, String> connectionProperties; 113 private Optional<SQLException> exception = Optional.empty(); 114 private byte set$0; 115 Builder() { 116 } 117 @Override 118 DatabaseInfo.Builder dbName(String dbName) { 119 if (dbName == null) { 120 throw new NullPointerException("Null dbName"); 121 } 122 this.dbName = dbName; 123 return this; 124 } 125 @Override 126 DatabaseInfo.Builder port(int port) { 127 this.port = port; 128 set$0 |= (byte) 1; 129 return this; 130 } 131 @Override 132 DatabaseInfo.Builder user(String user) { 133 if (user == null) { 134 throw new NullPointerException("Null user"); 135 } 136 this.user = user; 137 return this; 138 } 139 @Override 140 DatabaseInfo.Builder connectionProperties(ImmutableMap<String, String> connectionProperties) { 141 if (connectionProperties == null) { 142 throw new NullPointerException("Null connectionProperties"); 143 } 144 if (connectionPropertiesBuilder$ != null) { 145 throw new IllegalStateException("Cannot set connectionProperties after calling connectionPropertiesBuilder()"); 146 } 147 this.connectionProperties = connectionProperties; 148 return this; 149 } 150 @Override 151 ImmutableMap.Builder<String, String> connectionPropertiesBuilder() { 152 if (connectionPropertiesBuilder$ == null) { 153 if (connectionProperties == null) { 154 connectionPropertiesBuilder$ = ImmutableMap.builder(); 155 } else { 156 connectionPropertiesBuilder$ = ImmutableMap.builder(); 157 connectionPropertiesBuilder$.putAll(connectionProperties); 158 connectionProperties = null; 159 } 160 } 161 return connectionPropertiesBuilder$; 162 } 163 @Override 164 DatabaseInfo.Builder exception(SQLException exception) { 165 this.exception = Optional.of(exception); 166 return this; 167 } 168 @Override 169 DatabaseInfo build() { 170 if (connectionPropertiesBuilder$ != null) { 171 this.connectionProperties = connectionPropertiesBuilder$.buildOrThrow(); 172 } else if (this.connectionProperties == null) { 173 this.connectionProperties = ImmutableMap.of(); 174 } 175 if (set$0 != 1 176 || this.dbName == null 177 || this.user == null) { 178 StringBuilder missing = new StringBuilder(); 179 if (this.dbName == null) { 180 missing.append(" dbName"); 181 } 182 if ((set$0 & 1) == 0) { 183 missing.append(" port"); 184 } 185 if (this.user == null) { 186 missing.append(" user"); 187 } 188 throw new IllegalStateException("Missing required properties:" + missing); 189 } 190 return new AutoValue_DatabaseInfo( 191 this.dbName, 192 this.port, 193 this.user, 194 this.connectionProperties, 195 this.exception); 196 } 197 } 198 199 }