/** * Get the name of the {@link Template} HTML fragment (Element subtree) to be used as the template root of the given * {@link MetaClass} component type */ public static String getTemplateFragmentName(final MetaClass type) { String fragment = ""; if (type.isAnnotationPresent(Templated.class)) { final String source = canonicalizeTemplateSourceSyntax(type, type.getAnnotation(Templated.class).value()); final Matcher matcher = Pattern.compile("^.*#([^#]+)$").matcher(source); if (matcher.matches()) { fragment = (matcher.group(1) == null ? fragment : matcher.group(1)); } } return fragment; }
/** * Get the name of the {@link Template} HTML fragment (Element subtree) to be used as the template root of the given * {@link MetaClass} component type */ public static String getTemplateFragmentName(final MetaClass type) { String fragment = ""; if (type.isAnnotationPresent(Templated.class)) { final String source = canonicalizeTemplateSourceSyntax(type, type.getAnnotation(Templated.class).value()); final Matcher matcher = Pattern.compile("^.*#([^#]+)$").matcher(source); if (matcher.matches()) { fragment = (matcher.group(1) == null ? fragment : matcher.group(1)); } } return fragment; }
/** * Get the URL of the server-side {@link Template} HTML file of the given {@link MetaClass} component type */ public static String getTemplateUrl(final MetaClass type) { String resource = type.getFullyQualifiedName().replace('.', '/') + ".html"; if (type.isAnnotationPresent(Templated.class)) { final String source = canonicalizeTemplateSourceSyntax(type, type.getAnnotation(Templated.class).value()); final Matcher matcher = Pattern.compile("^([^#]+)#?.*$").matcher(source); if (matcher.matches()) { resource = (matcher.group(1) == null ? resource : matcher.group(1)); } } return resource; }
/** * Get the URL of the server-side {@link Template} HTML file of the given {@link MetaClass} component type */ public static String getTemplateUrl(final MetaClass type) { String resource = type.getFullyQualifiedName().replace('.', '/') + ".html"; if (type.isAnnotationPresent(Templated.class)) { final String source = canonicalizeTemplateSourceSyntax(type, type.getAnnotation(Templated.class).value()); final Matcher matcher = Pattern.compile("^([^#]+)#?.*$").matcher(source); if (matcher.matches()) { resource = (matcher.group(1) == null ? resource : matcher.group(1)); } } return resource; }
/** * Get the name of the {@link Template} HTML file of the given {@link MetaClass} component type */ public static String getTemplateFileName(final MetaClass type) { String resource = type.getFullyQualifiedName().replace('.', '/') + ".html"; if (type.isAnnotationPresent(Templated.class)) { final String source = canonicalizeTemplateSourceSyntax(type, type.getAnnotation(Templated.class).value()); final Matcher matcher = Pattern.compile("^([^#]+)#?.*$").matcher(source); if (matcher.matches()) { resource = (matcher.group(1) == null ? resource : matcher.group(1)); if (resource.matches("\\S+\\.html")) { if (resource.startsWith("/")) { resource = resource.substring(1); } else { resource = type.getPackageName().replace('.', '/') + "/" + resource; } } } } return resource; }
/** * Get the name of the {@link Template} HTML file of the given {@link MetaClass} component type */ public static String getTemplateFileName(final MetaClass type) { String resource = type.getFullyQualifiedName().replace('.', '/') + ".html"; if (type.isAnnotationPresent(Templated.class)) { final String source = canonicalizeTemplateSourceSyntax(type, type.getAnnotation(Templated.class).value()); final Matcher matcher = Pattern.compile("^([^#]+)#?.*$").matcher(source); if (matcher.matches()) { resource = (matcher.group(1) == null ? resource : matcher.group(1)); if (resource.matches("\\S+\\.html")) { if (resource.startsWith("/")) { resource = resource.substring(1); } else { resource = type.getPackageName().replace('.', '/') + "/" + resource; } } } } return resource; }