Back to project page getrest.
The source code is released under:
Apache License
If you think the Android project getrest listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright 2012 Alexey Hanin/*w w w . j a v a 2s .c o m*/ * * Licensed 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 getrest.android.core; /** * @author aha * @since 2012-01-13 */ public final class Method { public static final Method GET = new Method((byte) 1, "GET"); public static final Method POST = new Method((byte) 2, "POST"); public static final Method PUT = new Method((byte) 3, "PUT"); public static final Method DELETE = new Method((byte) 4, "DELETE"); private byte id; private String name; private Method(byte id, final String name) { this.id = id; this.name = name; } public byte getId() { return id; } public String getName() { return name; } public static Method byId(final byte id) { switch (id) { case 1: return GET; case 2: return POST; case 3: return PUT; case 4: return DELETE; default: return null; } } @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Method method = (Method) o; if (id != method.id) return false; return true; } @Override public int hashCode() { return id; } }