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.util.Date;
 import java.util.Set;
 
 
Class NetworkOffering

Author(s):
Adrian Cole
 
 public class NetworkOffering implements Comparable<NetworkOffering> {
 
    public static Builder<?> builder() {
       return new ConcreteBuilder();
    }
 
    public Builder<?> toBuilder() {
       return new ConcreteBuilder().fromNetworkOffering(this);
    }
 
    public abstract static class Builder<T extends Builder<T>> {
       protected abstract T self();
 
       protected String id;
       protected String name;
       protected String displayText;
       protected Date created;
       protected Integer maxConnections;
       protected boolean isDefault;
       protected boolean supportsVLAN;
       protected TrafficType trafficType;
       protected GuestIPType guestIPType;
       protected int networkRate;
       protected ImmutableSet.Builder<Stringtags = ImmutableSet.<String>builder();

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

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

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

      
 
       public T created(Date created) {
          this. = created;
          return self();
       }

      
 
       public T availability(NetworkOfferingAvailabilityType availability) {
          this. = availability;
          return self();
      }

      
      public T maxConnections(Integer maxConnections) {
         this. = maxConnections;
         return self();
      }

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

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

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

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

      
      public T networkRate(int networkRate) {
         this. = networkRate;
         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 NetworkOffering build() {
      }
      public T fromNetworkOffering(NetworkOffering in) {
         return this
               .id(in.getId())
               .name(in.getName())
               .displayText(in.getDisplayText())
               .created(in.getCreated())
               .availability(in.getAvailability())
               .maxConnections(in.getMaxConnections())
               .isDefault(in.isDefault())
               .supportsVLAN(in.supportsVLAN())
               .trafficType(in.getTrafficType())
               .guestIPType(in.getGuestIPType())
               .networkRate(in.getNetworkRate())
               .tags(in.getTags());
      }
   }
   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
      @Override
      protected ConcreteBuilder self() {
         return this;
      }
   }
   private final String id;
   private final String name;
   private final String displayText;
   private final Date created;
   private final Integer maxConnections;
   private final boolean isDefault;
   private final boolean supportsVLAN;
   private final TrafficType trafficType;
   private final GuestIPType guestIPType;
   private final int networkRate;
   private final Set<Stringtags;
         "id""name""displaytext""created""availability""maxconnections""isdefault""specifyvlan""traffictype""guestiptype""networkrate""tags"
   })
   protected NetworkOffering(String id, @Nullable String name, @Nullable String displayText, @Nullable Date created, @Nullable NetworkOfferingAvailabilityType availability, @Nullable Integer maxConnectionsboolean isDefaultboolean supportsVLAN, @Nullable TrafficType trafficType, @Nullable GuestIPType guestIPTypeint networkRate, @Nullable Iterable<Stringtags) {
      this. = checkNotNull(id"id");
      this. = name;
      this. = displayText;
      this. = created;
      this. = availability;
      this. = maxConnections;
      this. = isDefault;
      this. = supportsVLAN;
      this. = trafficType;
      this. = guestIPType;
      this. = networkRate;
      this. = tags != null ? ImmutableSet.copyOf(tags) : ImmutableSet.<Stringof();
   }

   

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

   

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

   

Returns:
an alternate display text of the network offering.
   public String getDisplayText() {
      return this.;
   }

   

Returns:
the date this network offering was created
   public Date getCreated() {
      return this.;
   }

   

Returns:
Availability name for the offering
      return this.;
   }

   

Returns:
the max number of concurrent connection the network offering supports
   public Integer getMaxConnections() {
      return this.;
   }

   

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

   

Returns:
true if network offering supports vlans, false otherwise
   public boolean supportsVLAN() {
      return this.;
   }

   

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

   

Returns:
the guest ip type for this network offering
   public GuestIPType getGuestIPType() {
      return this.;
   }

   

Returns:
data transfer rate in megabits per second allowed.
   public int getNetworkRate() {
      return this.;
   }

   

Returns:
the tags for the network offering
   public Set<StringgetTags() {
      return this.;
   }
   public int hashCode() {
   }
   public boolean equals(Object obj) {
      if (this == objreturn true;
      if (obj == null || getClass() != obj.getClass()) return false;
      NetworkOffering that = NetworkOffering.class.cast(obj);
      return Objects.equal(this.that.id)
            && Objects.equal(this.that.name)
            && Objects.equal(this.that.displayText)
            && Objects.equal(this.that.created)
            && Objects.equal(this.that.availability)
            && Objects.equal(this.that.maxConnections)
            && Objects.equal(this.that.isDefault)
            && Objects.equal(this.that.supportsVLAN)
            && Objects.equal(this.that.trafficType)
            && Objects.equal(this.that.guestIPType)
            && Objects.equal(this.that.networkRate)
            && Objects.equal(this.that.tags);
   }
   protected ToStringHelper string() {
      return Objects.toStringHelper(this)
            .add("id").add("name").add("displayText").add("created").add("availability").add("maxConnections").add("isDefault").add("supportsVLAN").add("trafficType").add("guestIPType").add("networkRate").add("tags");
   }
   public String toString() {
      return string().toString();
   }
   public int compareTo(NetworkOffering o) {
      return .compareTo(o.getId());
   }
New to GrepCode? Check out our FAQ X