congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Path
Code IndexAdd Tabnine to your IDE (free)

How to use
Path
in
juzu.impl.common

Best Java code snippets using juzu.impl.common.Path (Showing top 20 results out of 315)

origin: juzu/juzu

public Template(TemplateService plugin, String path) {
 this(plugin, Path.parse(path));
}
origin: org.juzu/juzu-core

public static Path create(boolean absolute, Name qn, String rawName, String ext) {
 if (absolute) {
  return absolute(qn, rawName,  ext);
 } else {
  return relative(qn, rawName, ext);
 }
}
origin: org.juzu/juzu-core

 @Override
 public Absolute as(String rawName, String ext) {
  return (Absolute)super.as(rawName, ext);
 }
}
origin: org.juzu/juzu-core

/**
 * Returns the path simple name: the raw name followed by the extension.
 *
 * @return the simple name
 */
public String getSimpleName() {
 String ext = getExt();
 String rawName = getRawName();
 if (ext != null) {
  return rawName + "." + ext;
 }
 else {
  return rawName;
 }
}
origin: org.juzu/juzu-core

/**
 * Resolve a path with respect to this name and return an absolute path.
 *
 * @param path the path
 * @return the corresponding absolute path
 */
public Path.Absolute resolve(Path path) {
 if (path instanceof Path.Absolute) {
  return (Path.Absolute)path;
 } else {
  return Path.absolute(append(path.getName()), path.getExt());
 }
}
origin: org.juzu/juzu-core

if (userText != null && userText.length() > 0) {
 try {
  Path path = Path.parse(userText);
  if (path.isRelative()) {
   File from;
   String suffix;
   if (path.getExt() == null) {
    from = sourcePath.getPath(root, path.getName());
    if (from == null) {
     from = sourcePath.getPath(root, path.getDirs());
     suffix = path.getSimpleName();
    } else {
     suffix = "";
    from = sourcePath.getPath(root, path.getDirs());
    suffix = path.getSimpleName();
origin: org.juzu/juzu-core

private void assertPath(boolean absolute, String[] names, String name, String extension, Path test) {
 Assert.assertEquals(absolute, test.isAbsolute());
 Iterable<String> qn = test.getDirs();
 Assert.assertNotNull(qn);
 Assert.assertEquals(Arrays.asList(names), Tools.list(qn));
 Assert.assertEquals(name, test.getRawName());
 Assert.assertEquals(extension, test.getExt());
}
origin: org.juzu/juzu-core

private void assertIAE(String prefixPath, String path) {
 Path p = Path.parse(prefixPath);
 try {
  p.append(path);
  throw AbstractTestCase.failure("Was expecting parsing of " + path + " to throw an IAE");
 }
 catch (IllegalArgumentException e) {
  // Ok
 }
}
origin: org.juzu/juzu-core

 @Override
 public Path.Absolute resolveTemplate(Path path) {
  if (path.getCanonical().equals("index.gtmpl")) {
   return (Path.Absolute)Path.parse("/plugin/template/tag/decorate/templates/index.gtmpl");
  }
  else {
   return null;
  }
 }
});
origin: org.juzu/juzu-core

public TemplatesDescriptor(
  ApplicationDescriptor application,
  ClassLoader loader,
  JSON config) throws Exception {
 ArrayList<BeanDescriptor> beans = new ArrayList<BeanDescriptor>();
 List<TemplateDescriptor> templates = new ArrayList<TemplateDescriptor>();
 //
 String packageName = config.getString("package");
 Name pkg = Name.parse(packageName);
 // Load templates
 for (String fqn : config.getList("templates", String.class)) {
  Class<?> clazz = loader.loadClass(fqn);
  Field f = clazz.getField("DESCRIPTOR");
  TemplateDescriptor descriptor = (TemplateDescriptor)f.get(null);
  templates.add(descriptor);
  juzu.impl.common.Path.Absolute path = (juzu.impl.common.Path.Absolute)juzu.impl.common.Path.parse(descriptor.getPath());
  Path qualifier;
  if (pkg.isPrefix(path.getName())) {
   juzu.impl.common.Path.Relative relativePath = juzu.impl.common.Path.relative(path.getName().subName(pkg.size()), path.getExt());
   qualifier = new PathLiteral(relativePath.getCanonical());
  } else {
   qualifier = new PathLiteral(path.getCanonical());
  }
  beans.add(BeanDescriptor.createFromImpl(Template.class, null, Arrays.<Annotation>asList(qualifier), descriptor.getType()));
 }
 //
 this.templates = templates;
 this.pkg = pkg;
 this.beans = beans;
}
origin: juzu/juzu

 path = Path.parse(resource);
Path.Absolute to = assetPkg.resolve(path.as("css"));
log.info("Resource " + resource + " destination resolved to " + to);
origin: juzu/juzu

public String getCanonical() {
 if (canonical == null) {
  StringBuilder sb = new StringBuilder();
  if (isAbsolute()) {
   sb.append('/');
  }
  for (int i = 0;i < name.size();i++) {
   if (i > 0) {
    sb.append('/');
   }
   sb.append(name.get(i));
  }
  String ext = getExt();
  if (ext != null) {
   sb.append('.').append(ext);
  }
  canonical = sb.toString();
 }
 return canonical;
}
origin: org.juzu/juzu-core

public final boolean isRelative() {
 return !isAbsolute();
}
origin: org.juzu/juzu-core

@Override
public String toString() {
 return "Path[" + getCanonical() +  "]";
}
origin: juzu/juzu

if (userText != null && userText.length() > 0) {
 try {
  Path path = Path.parse(userText);
  if (path.isRelative()) {
   File from;
   String suffix;
   if (path.getExt() == null) {
    from = sourcePath.getPath(root, path.getName());
    if (from == null) {
     from = sourcePath.getPath(root, path.getDirs());
     suffix = path.getSimpleName();
    } else {
     suffix = "";
    from = sourcePath.getPath(root, path.getDirs());
    suffix = path.getSimpleName();
origin: juzu/juzu

private void assertPath(boolean absolute, String[] names, String name, String extension, Path test) {
 Assert.assertEquals(absolute, test.isAbsolute());
 Iterable<String> qn = test.getDirs();
 Assert.assertNotNull(qn);
 Assert.assertEquals(Arrays.asList(names), Tools.list(qn));
 Assert.assertEquals(name, test.getRawName());
 Assert.assertEquals(extension, test.getExt());
}
origin: org.juzu/juzu-core

@Test
public void testAppendIAE() {
 assertPath(false, new String[]{}, "b", null, Path.parse("").append("b"));
 assertPath(false, new String[]{}, "b", "c", Path.parse("").append("b.c"));
 assertPath(false, new String[]{}, "b", null, Path.parse("").append("./b"));
 assertPath(false, new String[]{}, "c", null, Path.parse("a/b").append("../c"));
 assertPath(false, new String[]{}, "b", null, Path.parse("").append("a/../b"));
 assertPath(false, new String[]{}, "b", "c", Path.parse("").append("b.c"));
 assertPath(false, new String[]{"a"}, "c", null, Path.parse("a/b").append("c"));
 assertPath(false, new String[]{"a"}, "d", null, Path.parse("a/b.c").append("d"));
}
origin: juzu/juzu

 @Override
 public Path.Absolute resolveTemplate(Path path) {
  if (path.getCanonical().equals("index.gtmpl")) {
   return (Path.Absolute)Path.parse("/plugin/template/tag/decorate/templates/index.gtmpl");
  }
  else {
   return null;
  }
 }
});
origin: juzu/juzu

public TemplatesDescriptor(
  ApplicationDescriptor application,
  ClassLoader loader,
  JSON config) throws Exception {
 ArrayList<BeanDescriptor> beans = new ArrayList<BeanDescriptor>();
 List<TemplateDescriptor> templates = new ArrayList<TemplateDescriptor>();
 //
 String packageName = config.getString("package");
 Name pkg = Name.parse(packageName);
 // Load templates
 for (String fqn : config.getList("templates", String.class)) {
  Class<?> clazz = loader.loadClass(fqn);
  Field f = clazz.getField("DESCRIPTOR");
  TemplateDescriptor descriptor = (TemplateDescriptor)f.get(null);
  templates.add(descriptor);
  juzu.impl.common.Path.Absolute path = (juzu.impl.common.Path.Absolute)juzu.impl.common.Path.parse(descriptor.getPath());
  Path qualifier;
  if (pkg.isPrefix(path.getName())) {
   juzu.impl.common.Path.Relative relativePath = juzu.impl.common.Path.relative(path.getName().subName(pkg.size()), path.getExt());
   qualifier = new PathLiteral(relativePath.getCanonical());
  } else {
   qualifier = new PathLiteral(path.getCanonical());
  }
  beans.add(BeanDescriptor.createFromImpl(Template.class, null, Arrays.<Annotation>asList(qualifier), descriptor.getType()));
 }
 //
 this.templates = templates;
 this.pkg = pkg;
 this.beans = beans;
}
origin: org.juzu/juzu-plugins-less

 path = Path.parse(resource);
Path.Absolute to = assetPkg.resolve(path.as("css"));
log.info("Resource " + resource + " destination resolved to " + to);
juzu.impl.commonPath

Most used methods

  • parse
  • absolute
  • as
  • getCanonical
  • getDirs
    Returns the path directories as a name.
  • getExt
    Returns the path extension.
  • getRawName
    Returns the path raw name.
  • isAbsolute
  • relative
  • append
  • create
  • getName
    Returns the path as a name.
  • create,
  • getName,
  • getSimpleName,
  • isRelative

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • BoxLayout (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now