/src/main/java/com/impetus/kundera/loader/ClientType.java

https://github.com/kkmishra/Kundera · Java · 57 lines · 23 code · 4 blank · 30 comment · 2 complexity · a3de0591629268a093e6f7976065d158 MD5 · raw file

  1. /*******************************************************************************
  2. * * Copyright 2011 Impetus Infotech.
  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 com.impetus.kundera.loader;
  17. import java.util.HashMap;
  18. import java.util.Map;
  19. /**
  20. *
  21. * @author impetus
  22. *
  23. */
  24. public enum ClientType
  25. {
  26. HBASE, PELOPS, MONGODB, THRIFT;
  27. static Map<String, ClientType> coll = new HashMap<String, ClientType>();
  28. /**
  29. * Static initialisation.
  30. */
  31. static
  32. {
  33. coll.put(HBASE.name(), HBASE);
  34. coll.put(PELOPS.name(), PELOPS);
  35. coll.put(THRIFT.name(), THRIFT);
  36. coll.put(MONGODB.name(), MONGODB);
  37. }
  38. /**
  39. * Returns value of clientType
  40. *
  41. * @param clientType
  42. * client type
  43. * @return clientType enum value.
  44. */
  45. public static ClientType getValue(String clientType)
  46. {
  47. if (clientType == null)
  48. {
  49. throw new EnumConstantNotPresentException(null, clientType);
  50. }
  51. return coll.get(clientType);
  52. }
  53. }