Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License 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 org.jclouds.cloudstack.domain;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.net.URI;
 import java.util.List;
 import java.util.Set;
 
 
Class Network

Author(s):
Adrian Cole
 
 public class Network {
 
    public static Builder<?> builder() {
       return new ConcreteBuilder();
    }
 
    public Builder<?> toBuilder() {
       return new ConcreteBuilder().fromNetwork(this);
    }
 
    public abstract static class Builder<T extends Builder<T>> {
       protected abstract T self();
 
       protected String id;
       protected String account;
       protected String broadcastDomainType;
       protected URI broadcastURI;
       protected String displayText;
       protected String DNS1;
       protected String DNS2;
       protected String domain;
       protected String domainId;
       protected String endIP;
       protected String gateway;
       protected boolean isDefault;
       protected boolean isShared;
       protected boolean isSystem;
       protected String netmask;
       protected String networkDomain;
       protected String networkOfferingAvailability;
       protected String networkOfferingDisplayText;
       protected String networkOfferingId;
       protected String networkOfferingName;
       protected String related;
       protected String startIP;
       protected String name;
       protected String state;
       protected GuestIPType guestIPType;
       protected String VLAN;
       protected TrafficType trafficType;
       protected String zoneId;
       protected ImmutableSet.Builder<Stringtags = ImmutableSet.<String>builder();
       protected boolean securityGroupEnabled;
       protected Set<? extends NetworkServiceservices = ImmutableSortedSet.of();

      

See also:
Network.getId()
 
       public T id(String id) {
          this. = id;
          return self();
       }

      
 
       public T account(String account) {
          this. = account;
          return self();
       }

      
      public T broadcastDomainType(String broadcastDomainType) {
         this. = broadcastDomainType;
         return self();
      }

      
      public T broadcastURI(URI broadcastURI) {
         this. = broadcastURI;
         return self();
      }

      
      public T displayText(String displayText) {
         this. = displayText;
         return self();
      }

      

Returns:
the DNS for the Network
      public T DNS(List<StringDNS) {
         if (!DNS.isEmpty()) this. = DNS.get(0);
         if (DNS.size() > 1) this. = DNS.get(1);
         return self();
      }

      
      public T domain(String domain) {
         this. = domain;
         return self();
      }

      
      public T domainId(String domainId) {
         this. = domainId;
         return self();
      }

      
      public T endIP(String endIP) {
         this. = endIP;
         return self();
      }

      
      public T gateway(String gateway) {
         this. = gateway;
         return self();
      }

      
      public T isDefault(boolean isDefault) {
         this. = isDefault;
         return self();
      }

      
      public T isShared(boolean isShared) {
         this. = isShared;
         return self();
      }

      
      public T isSystem(boolean isSystem) {
         this. = isSystem;
         return self();
      }

      
      public T netmask(String netmask) {
         this. = netmask;
         return self();
      }

      
      public T networkDomain(String networkDomain) {
         this. = networkDomain;
         return self();
      }

      
      public T networkOfferingAvailability(String networkOfferingAvailability) {
         this. = networkOfferingAvailability;
         return self();
      }

      
      public T networkOfferingDisplayText(String networkOfferingDisplayText) {
         this. = networkOfferingDisplayText;
         return self();
      }

      
      public T networkOfferingId(String networkOfferingId) {
         this. = networkOfferingId;
         return self();
      }

      
      public T networkOfferingName(String networkOfferingName) {
         this. = networkOfferingName;
         return self();
      }

      
      public T related(String related) {
         this. = related;
         return self();
      }

      
      public T startIP(String startIP) {
         this. = startIP;
         return self();
      }

      
      public T name(String name) {
         this. = name;
         return self();
      }

      
      public T state(String state) {
         this. = state;
         return self();
      }

      
      public T guestIPType(GuestIPType guestIPType) {
         this. = guestIPType;
         return self();
      }

      
      public T VLAN(String VLAN) {
         this. = VLAN;
         return self();
      }

      
      public T trafficType(TrafficType trafficType) {
         this. = trafficType;
         return self();
      }

      
      public T zoneId(String zoneId) {
         this. = zoneId;
         return self();
      }

      
      public T tags(Iterable<Stringtags) {
         this. = ImmutableSet.<String>builder().addAll(tags);
         return self();
      }
      
      
      public T tag(String tag) {
         this..add(tag);
         return self();
      }
      

      
      public T securityGroupEnabled(boolean securityGroupEnabled) {
         this. = securityGroupEnabled;
         return self();
      }

      
      public T services(Set<? extends NetworkServiceservices) {
         this. = services;
         return self();
      }
      public Network build() {
      }
      public T fromNetwork(Network in) {
         return this
               .id(in.getId())
               .account(in.getAccount())
               .broadcastDomainType(in.getBroadcastDomainType())
               .broadcastURI(in.getBroadcastURI())
               .displayText(in.getDisplayText())
               .DNS(in.getDNS())
               .domain(in.getDomain())
               .domainId(in.getDomainId())
               .endIP(in.getEndIP())
               .gateway(in.getGateway())
               .isDefault(in.isDefault())
               .isShared(in.isShared())
               .isSystem(in.isSystem())
               .netmask(in.getNetmask())
               .networkDomain(in.getNetworkDomain())
               .networkOfferingId(in.getNetworkOfferingId())
               .networkOfferingName(in.getNetworkOfferingName())
               .related(in.getRelated())
               .startIP(in.getStartIP())
               .name(in.getName())
               .state(in.getState())
               .guestIPType(in.getGuestIPType())
               .VLAN(in.getVLAN())
               .trafficType(in.getTrafficType())
               .zoneId(in.getZoneId())
               .tags(in.getTags())
               .securityGroupEnabled(in.isSecurityGroupEnabled())
               .services(in.getServices());
      }
   }
   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
      @Override
      protected ConcreteBuilder self() {
         return this;
      }
   }
   private final String id;
   private final String account;
   private final String broadcastDomainType;
   private final URI broadcastURI;
   private final String displayText;
   private final String DNS1;
   private final String DNS2;
   private final String domain;
   private final String domainId;
   private final String endIP;
   private final String gateway;
   private final boolean isDefault;
   private final boolean isShared;
   private final boolean isSystem;
   private final String netmask;
   private final String networkDomain;
   private final String networkOfferingAvailability;
   private final String networkOfferingDisplayText;
   private final String networkOfferingId;
   private final String networkOfferingName;
   private final String related;
   private final String startIP;
   private final String name;
   private final String state;
   private final GuestIPType guestIPType;
   private final String VLAN;
   private final TrafficType trafficType;
   private final String zoneId;
   private final Set<Stringtags;
   private final boolean securityGroupEnabled;
   private final Set<? extends NetworkServiceservices;
         "id""account""broadcastdomaintype""broadcasturi""displaytext""dns1""dns2""domain""domainid""endip""gateway""isdefault""isshared""issystem""netmask""networkdomain""networkofferingavailability""networkofferingdisplaytext""networkofferingid""networkofferingname""related""startip""name""state""type""vlan""traffictype""zoneid""tags""securitygroupenabled""service"
   })
   protected Network(String id, @Nullable String account, @Nullable String broadcastDomainType, @Nullable URI broadcastURI,
                     @Nullable String displayText, @Nullable String DNS1, @Nullable String DNS2, @Nullable String domain, @Nullable String domainId,
                     @Nullable String endIP, @Nullable String gatewayboolean isDefaultboolean isSharedboolean isSystem,
                     @Nullable String netmask, @Nullable String networkDomain, @Nullable String networkOfferingAvailability,
                     @Nullable String networkOfferingDisplayText, @Nullable String networkOfferingId, @Nullable String networkOfferingName,
                     @Nullable String related, @Nullable String startIP, @Nullable String name, @Nullable String state,
                     @Nullable GuestIPType guestIPType, @Nullable String VLAN, @Nullable TrafficType trafficType,
                     @Nullable String zoneId, @Nullable Iterable<Stringtagsboolean securityGroupEnabledSet<? extends NetworkServiceservices) {
      this. = checkNotNull(id"id");
      this. = account;
      this. = broadcastDomainType;
      this. = broadcastURI;
      this. = displayText;
      this. = DNS1;
      this. = DNS2;
      this. = domain;
      this. = domainId;
      this. = endIP;
      this. = gateway;
      this. = isDefault;
      this. = isShared;
      this. = isSystem;
      this. = netmask;
      this. = networkDomain;
      this. = networkOfferingAvailability;
      this. = networkOfferingDisplayText;
      this. = networkOfferingId;
      this. = networkOfferingName;
      this. = related;
      this. = startIP;
      this. = name;
      this. = state;
      this. = guestIPType;
      this. = VLAN;
      this. = trafficType;
      this. = zoneId;
      this. = tags != null ? ImmutableSet.copyOf(tags) : ImmutableSet.<Stringof();
      this. = securityGroupEnabled;
      this. = ImmutableSortedSet.copyOf(services);
   }

   

Returns:
network id
   public String getId() {
      return this.;
   }

   

Returns:
the account associated with the network
   public String getAccount() {
      return this.;
   }

   

Returns:
Broadcast domain type of the network
   public String getBroadcastDomainType() {
      return this.;
   }

   

Returns:
broadcast uri of the network
   public URI getBroadcastURI() {
      return this.;
   }

   

Returns:
the display text of the zone
   public String getDisplayText() {
      return this.;
   }
   public List<StringgetDNS() {
      ImmutableList.Builder<Stringbuilder = ImmutableList.builder();
      if ( != null && !"".equals())
         builder.add();
      if ( != null && !"".equals())
         builder.add();
      return builder.build();
   }

   

Returns:
Domain name for the Network
   public String getDomain() {
      return this.;
   }

   

Returns:
the domain id of the Network
   public String getDomainId() {
      return this.;
   }

   

Returns:
the end ip of the network
   public String getEndIP() {
      return this.;
   }

   

Returns:
the network's gateway
   public String getGateway() {
      return this.;
   }

   

Returns:
true if network offering is default, false otherwise
   public boolean isDefault() {
      return this.;
   }

   

Returns:
true if network offering is shared, false otherwise
   public boolean isShared() {
      return this.;
   }

   

Returns:
true if network offering is system, false otherwise
   public boolean isSystem() {
      return this.;
   }

   

Returns:
the network's netmask
   public String getNetmask() {
      return this.;
   }

   

Returns:
the network domain
   public String getNetworkDomain() {
      return this.;
   }

   

Returns:
availability of the network offering the network is created from
      return this.;
   }

   

Returns:
display text of the network offering the network is created from
      return this.;
   }

   

Returns:
network offering id the network is created from
   public String getNetworkOfferingId() {
      return this.;
   }

   

Returns:
name of the network offering the network is created from
   public String getNetworkOfferingName() {
      return this.;
   }

   

Returns:
related to what other network configuration
   public String getRelated() {
      return this.;
   }

   

Returns:
the start ip of the network
   public String getStartIP() {
      return this.;
   }

   

Returns:
network name
   public String getName() {
      return this.;
   }

   

Returns:
state of the network
   public String getState() {
      return this.;
   }

   

Returns:
the GuestIPType of the network
   public GuestIPType getGuestIPType() {
      return this.;
   }

   

Returns:
the vlan range of the zone
   public String getVLAN() {
      return this.;
   }

   

Returns:
the traffic type for this network offering
   public TrafficType getTrafficType() {
      return this.;
   }

   

Returns:
zone id of the network
   public String getZoneId() {
      return this.;
   }

   

Returns:
the tags for the Network
   public Set<StringgetTags() {
      return this.;
   }

   

Returns:
true if security group is enabled, false otherwise
   public boolean isSecurityGroupEnabled() {
      return this.;
   }

   

Returns:
the list of services
   public Set<? extends NetworkServicegetServices() {
      return this.;
   }
   public int hashCode() {
   }
   public boolean equals(Object obj) {
      if (this == objreturn true;
      if (obj == null || getClass() != obj.getClass()) return false;
      Network that = Network.class.cast(obj);
      return Objects.equal(this.that.id)
            && Objects.equal(this.that.account)
            && Objects.equal(this.that.broadcastDomainType)
            && Objects.equal(this.that.broadcastURI)
            && Objects.equal(this.that.displayText)
            && Objects.equal(this.that.DNS1)
            && Objects.equal(this.that.DNS2)
            && Objects.equal(this.that.domain)
            && Objects.equal(this.that.domainId)
            && Objects.equal(this.that.endIP)
            && Objects.equal(this.that.gateway)
            && Objects.equal(this.that.isDefault)
            && Objects.equal(this.that.isShared)
            && Objects.equal(this.that.isSystem)
            && Objects.equal(this.that.netmask)
            && Objects.equal(this.that.networkDomain)
            && Objects.equal(this.that.networkOfferingAvailability)
            && Objects.equal(this.that.networkOfferingDisplayText)
            && Objects.equal(this.that.networkOfferingId)
            && Objects.equal(this.that.networkOfferingName)
            && Objects.equal(this.that.related)
            && Objects.equal(this.that.startIP)
            && Objects.equal(this.that.name)
            && Objects.equal(this.that.state)
            && Objects.equal(this.that.guestIPType)
            && Objects.equal(this.that.VLAN)
            && Objects.equal(this.that.trafficType)
            && Objects.equal(this.that.zoneId)
            && Objects.equal(this.that.tags)
            && Objects.equal(this.that.securityGroupEnabled)
            && Objects.equal(this.that.services);
   }
   protected ToStringHelper string() {
      return Objects.toStringHelper(this)
            .add("id").add("account").add("broadcastDomainType").add("broadcastURI")
            .add("displayText").add("DNS1").add("DNS2").add("domain").add("domainId")
            .add("endIP").add("gateway").add("isDefault").add("isShared").add("isSystem")
            .add("netmask").add("networkDomain").add("networkOfferingAvailability")
            .add("networkOfferingDisplayText").add("networkOfferingId")
            .add("networkOfferingName").add("related").add("startIP").add("name")
            .add("state").add("guestIPType").add("VLAN").add("trafficType")
            .add("zoneId").add("tags").add("securityGroupEnabled").add("services");
   }
   public String toString() {
      return string().toString();
   }
New to GrepCode? Check out our FAQ X