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
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • getSystemService (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Collectors (java.util.stream)
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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