2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.model.util.generated.type.builder;
10 import java.util.Objects;
11 import org.opendaylight.mdsal.binding.model.api.Constant;
12 import org.opendaylight.mdsal.binding.model.api.Type;
14 final class ConstantImpl implements Constant {
15 private final Type type;
16 private final String name;
17 private final Object value;
19 ConstantImpl(final Type type, final String name, final Object value) {
26 public Type getType() {
31 public String getName() {
36 public Object getValue() {
41 public String toFormattedString() {
42 return type + " " + name + " " + value;
46 public int hashCode() {
49 result = prime * result + Objects.hashCode(this.name);
50 result = prime * result + Objects.hashCode(this.type);
55 public boolean equals(final Object obj) {
59 if (obj == null || getClass() != obj.getClass()) {
62 final ConstantImpl other = (ConstantImpl) obj;
63 return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type)
64 && Objects.equals(this.value, other.value);
68 public String toString() {
69 final StringBuilder builder = new StringBuilder();
70 builder.append("Constant [type=");
71 builder.append(this.type);
72 builder.append(", name=");
73 builder.append(this.name);
74 builder.append(", value=");
75 builder.append(this.value);
77 return builder.toString();