Validates all required fields and constructs an immutable Device. Mandatory parameters include host name, user credentials (or key), and host‑key settings when strict checking is enabled. If any of these are missing or inconsistent, a NetconfException is thrown. @return a fully
()
| 332 | * occurs while initialising auxiliary resources |
| 333 | */ |
| 334 | public Device build() throws NetconfException { |
| 335 | // Validation logic moved from Device constructor |
| 336 | if (hostName == null) throw new NetconfException("hostName is required"); |
| 337 | if (userName == null) throw new NetconfException("userName is required"); |
| 338 | if (!keyAuth && password == null) |
| 339 | throw new NetconfException("Password is required for password auth"); |
| 340 | if (strictHostKeyChecking && hostKeysFileName == null) |
| 341 | throw new NetconfException("hostKeysFileName required when strictHostKeyChecking=true"); |
| 342 | if (keyAuth && pemKeyFile == null) |
| 343 | throw new NetconfException("pemKeyFile required when keyAuth=true"); |
| 344 | try { |
| 345 | return new Device(this); |
| 346 | } catch (NetconfException e) { |
| 347 | throw e; |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | /* ------------------------------------------------------------------ |
no outgoing calls