| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.deltacloud.domain; |
| 20 | |
| 21 | import static com.google.common.base.Preconditions.checkNotNull; |
| 22 | |
| 23 | /** |
| 24 | * |
| 25 | * @author Adrian Cole |
| 26 | */ |
| 27 | public class TransitionAutomatically implements Transition { |
| 28 | private final Instance.State to; |
| 29 | |
| 30 | public TransitionAutomatically(Instance.State to) { |
| 31 | this.to = checkNotNull(to, "to"); |
| 32 | } |
| 33 | |
| 34 | public Instance.State getTo() { |
| 35 | return to; |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public String toString() { |
| 40 | return "[to=" + to + "]"; |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public int hashCode() { |
| 45 | final int prime = 31; |
| 46 | int result = 1; |
| 47 | result = prime * result + ((to == null) ? 0 : to.hashCode()); |
| 48 | return result; |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public boolean equals(Object obj) { |
| 53 | if (this == obj) |
| 54 | return true; |
| 55 | if (obj == null) |
| 56 | return false; |
| 57 | if (getClass() != obj.getClass()) |
| 58 | return false; |
| 59 | TransitionAutomatically other = (TransitionAutomatically) obj; |
| 60 | if (to == null) { |
| 61 | if (other.to != null) |
| 62 | return false; |
| 63 | } else if (!to.equals(other.to)) |
| 64 | return false; |
| 65 | return true; |
| 66 | } |
| 67 | } |