@Test public void testCreate$regular() throws Exception { InMemorySlug slug=InMemorySlug.create("slug", container); System.out.println(slug); assertThat(slug.preferredPath(),equalTo("slug")); assertThat(slug.version(),equalTo(0L)); assertThat(slug.containerId(),equalTo(this.container.id())); }
static InMemorySlug create(String slugPath, Container container) { Matcher matcher = SLUG_PATH_PATTERN.matcher(slugPath); String path=slugPath; long version=0; if(matcher.matches()) { String strVersion = matcher.group(3); if(strVersion!=null) { String strPath = matcher.group(1); if(!strPath.isEmpty()) { path=strPath; version=Long.parseLong(strVersion); } } } return new InMemorySlug(container.id(),path,version); }
InMemorySlug implements Slug { static InMemorySlug create(String slugPath, Container container) { Matcher matcher = SLUG_PATH_PATTERN.matcher(slugPath); String path=slugPath; long version=0; if(matcher.matches()) { String strVersion = matcher.group(3); if(strVersion!=null) { String strPath = matcher.group(1); if(!strPath.isEmpty()) { path=strPath; version=Long.parseLong(strVersion); } } } return new InMemorySlug(container.id(),path,version); } }
InMemorySlug implements Slug { static InMemorySlug create(String slugPath, Container container) { Matcher matcher = SLUG_PATH_PATTERN.matcher(slugPath); String path=slugPath; long version=0; if(matcher.matches()) { String strVersion = matcher.group(3); if(strVersion!=null) { String strPath = matcher.group(1); if(!strPath.isEmpty()) { path=strPath; version=Long.parseLong(strVersion); } } } return new InMemorySlug(container.id(),path,version); } private  InMemorySlug(ResourceId containerId, String preferredPath, long version); }
InMemorySlug implements Slug { static InMemorySlug create(String slugPath, Container container) { Matcher matcher = SLUG_PATH_PATTERN.matcher(slugPath); String path=slugPath; long version=0; if(matcher.matches()) { String strVersion = matcher.group(3); if(strVersion!=null) { String strPath = matcher.group(1); if(!strPath.isEmpty()) { path=strPath; version=Long.parseLong(strVersion); } } } return new InMemorySlug(container.id(),path,version); } private  InMemorySlug(ResourceId containerId, String preferredPath, long version); @Override ResourceId containerId(); @Override String preferredPath(); @Override synchronized long version(); @Override synchronized String nextPath(); @Override String toString(); }
InMemorySlug implements Slug { static InMemorySlug create(String slugPath, Container container) { Matcher matcher = SLUG_PATH_PATTERN.matcher(slugPath); String path=slugPath; long version=0; if(matcher.matches()) { String strVersion = matcher.group(3); if(strVersion!=null) { String strPath = matcher.group(1); if(!strPath.isEmpty()) { path=strPath; version=Long.parseLong(strVersion); } } } return new InMemorySlug(container.id(),path,version); } private  InMemorySlug(ResourceId containerId, String preferredPath, long version); @Override ResourceId containerId(); @Override String preferredPath(); @Override synchronized long version(); @Override synchronized String nextPath(); @Override String toString();  }