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.Set;
 
 
Class IPForwardingRule

Author(s):
Adrian Cole
 
 public class IPForwardingRule implements Comparable<IPForwardingRule> {
 
    public static Builder<?> builder() {
       return new ConcreteBuilder();
    }
 
    public Builder<?> toBuilder() {
       return new ConcreteBuilder().fromIPForwardingRule(this);
    }
 
    public abstract static class Builder<T extends Builder<T>> {
       protected abstract T self();
 
       protected String id;
       protected String IPAddress;
       protected String IPAddressId;
       protected int startPort;
       protected String protocol;
       protected int endPort;
       protected String state;
       protected String virtualMachineDisplayName;
       protected String virtualMachineId;
       protected String virtualMachineName;
       protected int publicPort;
       protected Set<StringCIDRs = ImmutableSet.of();
       protected int privateEndPort;
       protected int publicEndPort;

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

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

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

      
 
       public T startPort(int startPort) {
          this. = startPort;
          return self();
       }

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

      
      public T endPort(int endPort) {
         this. = endPort;
         return self();
      }

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

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

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

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

      
      public T publicPort(int publicPort) {
         this. = publicPort;
         return self();
      }

      
      public T CIDRs(Set<StringCIDRs) {
         this. = ImmutableSet.copyOf(checkNotNull(CIDRs"CIDRs"));
         return self();
      }
      public T CIDRs(String... in) {
         return CIDRs(ImmutableSet.copyOf(in));
      }

      
      public T privateEndPort(int privateEndPort) {
         this. = privateEndPort;
         return self();
      }

      
      public T publicEndPort(int publicEndPort) {
         this. = publicEndPort;
         return self();
      }
      public IPForwardingRule build() {
      }
      public T fromIPForwardingRule(IPForwardingRule in) {
         return this
               .id(in.getId())
               .IPAddress(in.getIPAddress())
               .IPAddressId(in.getIPAddressId())
               .startPort(in.getStartPort())
               .protocol(in.getProtocol())
               .endPort(in.getEndPort())
               .state(in.getState())
               .virtualMachineDisplayName(in.getVirtualMachineDisplayName())
               .virtualMachineId(in.getVirtualMachineId())
               .virtualMachineName(in.getVirtualMachineName())
               .publicPort(in.getPublicPort())
               .CIDRs(in.getCIDRs())
               .privateEndPort(in.getPrivateEndPort())
               .publicEndPort(in.getPublicEndPort());
      }
   }
   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
      @Override
      protected ConcreteBuilder self() {
         return this;
      }
   }
   private final String id;
   private final String IPAddress;
   private final String IPAddressId;
   private final int startPort;
   private final String protocol;
   private final int endPort;
   private final String state;
   private final String virtualMachineDisplayName;
   private final String virtualMachineId;
   private final String virtualMachineName;
   private final int publicPort;
   private final Set<StringCIDRs;
   private final int privateEndPort;
   private final int publicEndPort;
         "id""ipaddress""ipaddressid""startport""protocol""endport""state""virtualmachinedisplayname",
         "virtualmachineid""virtualmachinename""publicport""cidrlist""privateendport""publicendport"
   })
   protected IPForwardingRule(String idString IPAddressString IPAddressIdint startPort, @Nullable String protocol,
                              int endPort, @Nullable String state, @Nullable String virtualMachineDisplayName,
                              @Nullable String virtualMachineId, @Nullable String virtualMachineNameint publicPort,
                              @Nullable Set<StringCIDRsint privateEndPortint publicEndPort) {
      this. = checkNotNull(id"id");
      this. = IPAddress;
      this. = IPAddressId;
      this. = startPort;
      this. = protocol;
      this. = endPort;
      this. = state;
      this. = virtualMachineDisplayName;
      this. = virtualMachineId;
      this. = virtualMachineName;
      this. = publicPort;
      this. = CIDRs == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(CIDRs);
      this. = privateEndPort;
      this. = publicEndPort;
   }

   

Returns:
the ID of the ip forwarding rule
   public String getId() {
      return this.;
   }

   

Returns:
the public ip address for the ip forwarding rule
   public String getIPAddress() {
      return this.;
   }

   

Returns:
the public ip address id for the ip forwarding rule
   public String getIPAddressId() {
      return this.;
   }

   

Returns:
the private port for the ip forwarding rule
   public int getStartPort() {
      return this.;
   }

   

Returns:
the protocol of the ip forwarding rule
   public String getProtocol() {
      return this.;
   }

   

Returns:
the public port for the ip forwarding rule
   public int getEndPort() {
      return this.;
   }

   

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

   

Returns:
the VM display name for the ip forwarding rule
      return this.;
   }

   

Returns:
the VM ID for the ip forwarding rule
   public String getVirtualMachineId() {
      return this.;
   }

   

Returns:
the VM name for the ip forwarding rule
   public String getVirtualMachineName() {
      return this.;
   }

   

Returns:
the starting port of port forwarding rule's public port range
   public int getPublicPort() {
      return this.;
   }

   

Returns:
the cidr list to forward traffic from
   public Set<StringgetCIDRs() {
      return this.;
   }

   

Returns:
the ending port of port forwarding rule's private port range
   public int getPrivateEndPort() {
      return this.;
   }

   

Returns:
the ending port of port forwarding rule's private port range
   public int getPublicEndPort() {
      return this.;
   }
   public int hashCode() {
   }
   public boolean equals(Object obj) {
      if (this == objreturn true;
      if (obj == null || getClass() != obj.getClass()) return false;
      IPForwardingRule that = IPForwardingRule.class.cast(obj);
      return Objects.equal(this.that.id)
            && Objects.equal(this.that.IPAddress)
            && Objects.equal(this.that.IPAddressId)
            && Objects.equal(this.that.startPort)
            && Objects.equal(this.that.protocol)
            && Objects.equal(this.that.endPort)
            && Objects.equal(this.that.state)
            && Objects.equal(this.that.virtualMachineDisplayName)
            && Objects.equal(this.that.virtualMachineId)
            && Objects.equal(this.that.virtualMachineName)
            && Objects.equal(this.that.publicPort)
            && Objects.equal(this.that.CIDRs)
            && Objects.equal(this.that.privateEndPort)
            && Objects.equal(this.that.publicEndPort);
   }
   protected ToStringHelper string() {
      return Objects.toStringHelper(this)
            .add("id").add("IPAddress").add("IPAddressId").add("startPort")
            .add("protocol").add("endPort").add("state").add("virtualMachineDisplayName")
            .add("virtualMachineId").add("virtualMachineName").add("publicPort")
            .add("CIDRs").add("privateEndPort").add("publicEndPort");
   }
   public String toString() {
      return string().toString();
   }
   public int compareTo(IPForwardingRule o) {
      return .compareTo(o.getId());
   }
New to GrepCode? Check out our FAQ X