RequestMethodEnum.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright 2019-2020 Zheng Jie
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package me.zhengjie.utils.enums;
  17. import lombok.AllArgsConstructor;
  18. import lombok.Getter;
  19. /**
  20. * @author Zheng Jie
  21. * @website https://eladmin.vip
  22. * @description
  23. * @date 2020-06-10
  24. **/
  25. @Getter
  26. @AllArgsConstructor
  27. public enum RequestMethodEnum {
  28. /**
  29. * 搜寻 @AnonymousGetMapping
  30. */
  31. GET("GET"),
  32. /**
  33. * 搜寻 @AnonymousPostMapping
  34. */
  35. POST("POST"),
  36. /**
  37. * 搜寻 @AnonymousPutMapping
  38. */
  39. PUT("PUT"),
  40. /**
  41. * 搜寻 @AnonymousPatchMapping
  42. */
  43. PATCH("PATCH"),
  44. /**
  45. * 搜寻 @AnonymousDeleteMapping
  46. */
  47. DELETE("DELETE"),
  48. /**
  49. * 否则就是所有 Request 接口都放行
  50. */
  51. ALL("All");
  52. /**
  53. * Request 类型
  54. */
  55. private final String type;
  56. public static RequestMethodEnum find(String type) {
  57. for (RequestMethodEnum value : RequestMethodEnum.values()) {
  58. if (value.getType().equals(type)) {
  59. return value;
  60. }
  61. }
  62. return ALL;
  63. }
  64. }