{"id":2114,"date":"2012-06-09T10:00:22","date_gmt":"2012-06-09T08:00:22","guid":{"rendered":"http:\/\/blog.unelink.es\/?p=2114"},"modified":"2012-06-11T10:22:53","modified_gmt":"2012-06-11T08:22:53","slug":"uuid-en-java-identificadores-unicos","status":"publish","type":"post","link":"https:\/\/hosting.airetech.es\/blog\/wiki\/uuid-en-java-identificadores-unicos\/","title":{"rendered":"UUID en Java (Identificadores Unicos)"},"content":{"rendered":"<p>La manera m\u00e1s sencilla de generar un UUID (Universally Unique Identifier) es mediante la clase<\/p>\n<pre>randomUUID<\/pre>\n<p>del paquete<\/p>\n<pre>java.util.UUID<\/pre>\n<p>El\u00a0c\u00f3digo\u00a0concreto es:<\/p>\n<pre>String uuid = java.util.UUID.randomUUID().toString();<\/pre>\n<p>Tambi\u00e9n podemos crearnos un\u00a0m\u00e9todo\u00a0est\u00e1tico\u00a0que nos los devuelva como una cadena sin formato ni caracteres que no sean n\u00famero y letras<\/p>\n<pre>public static final String uuid()\r\n{\r\n\u00a0\u00a0\u00a0\u00a0String result = java.util.UUID.randomUUID().toString();\r\n\r\n\u00a0\u00a0\u00a0\u00a0result.replaceAll(\"-\", \"\");\r\n\u00a0\u00a0\u00a0\u00a0result.substring(0, 32);\r\n\r\n\u00a0\u00a0\u00a0\u00a0return result;\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"La manera m\u00e1s sencilla de generar un UUID (Universally Unique Identifier) es mediante la clase randomUUID del paquete java.util.UUID El\u00a0c\u00f3digo\u00a0concreto es: String uuid = java.util.UUID.randomUUID().toString(); Tambi\u00e9n podemos crearnos un\u00a0m\u00e9todo\u00a0est\u00e1tico\u00a0que nos los devuelva como una cadena sin formato ni caracteres que no sean n\u00famero y letras public static final String uuid() { \u00a0\u00a0\u00a0\u00a0String result = java.util.UUID.randomUUID().toString(); \u00a0\u00a0\u00a0\u00a0result.replaceAll(\"-\", \"\"); \u00a0\u00a0\u00a0\u00a0result.substring(0, 32); \u00a0\u00a0\u00a0\u00a0return&nbsp;<a href=\"https:\/\/hosting.airetech.es\/blog\/wiki\/uuid-en-java-identificadores-unicos\/\" class=\"read-more\">Seguir leyendo<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[123,6],"tags":[124,125],"class_list":["post-2114","post","type-post","status-publish","format-standard","hentry","category-java","category-wiki","tag-java-2","tag-uuid","cat-123-id","cat-6-id"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/2114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/comments?post=2114"}],"version-history":[{"count":18,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/2114\/revisions"}],"predecessor-version":[{"id":2185,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/2114\/revisions\/2185"}],"wp:attachment":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/media?parent=2114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/categories?post=2114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/tags?post=2114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}