当前位置: 首页>>代码示例>>Java>>正文


Java Directives类代码示例

本文整理汇总了Java中org.xembly.Directives的典型用法代码示例。如果您正苦于以下问题:Java Directives类的具体用法?Java Directives怎么用?Java Directives使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Directives类属于org.xembly包,在下文中一共展示了Directives类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scripts

import org.xembly.Directives; //导入依赖的package包/类
@Override
public Iterable<Iterable<Directive>> scripts() {
    return new Mapped<Item, Iterable<Directive>>(
        item -> new Directives()
            .add("script")
            .add("name").set(item.get("name").getS()).up()
            .add("bash").set(item.get("bash").getS()).up()
            .add("paid").set(item.get("paid").getN()).up()
            .add("used").set(item.get("used").getN()).up()
            .add("hour").set(item.get("hour").getN()).up()
            .add("day").set(item.get("day").getN()).up()
            .add("week").set(item.get("week").getN()).up()
            .up(),
        this.region.table("scripts")
            .frame()
            .through(
                new QueryValve()
                    // @checkstyle MagicNumber (1 line)
                    .withLimit(10)
                    .withSelect(Select.ALL_ATTRIBUTES)
            )
            .where("login", this.login)
        );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:25,代码来源:DyUser.java

示例2: logs

import org.xembly.Directives; //导入依赖的package包/类
@Override
public Iterable<Iterable<Directive>> logs() {
    return new Mapped<Item, Iterable<Directive>>(
        item -> new Directives()
            .add("log")
            .add("group").set(item.get("group").getS()).up()
            .add("start").set(item.get("start").getN()).up()
            .add("finish").set(item.get("finish").getN()).up()
            .add("period").set(item.get("period").getS()).up()
            .add("ocket").set(item.get("ocket").getS()).up()
            .add("exit").set(item.get("exit").getN()).up()
            .up(),
        this.region.table("logs")
            .frame()
            .through(
                new QueryValve()
                    .withIndexName("mine")
                    // @checkstyle MagicNumber (1 line)
                    .withLimit(20)
                    .withConsistentRead(false)
                    .withScanIndexForward(false)
                    .withSelect(Select.ALL_ATTRIBUTES)
            )
            .where("login", this.login)
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:27,代码来源:DyUser.java

示例3: act

import org.xembly.Directives; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
    return new RsPage(
        "/xsl/logs.xsl",
        request,
        () -> new StickyList<>(
            new XeAppend("menu", "logs"),
            new XeDirectives(
                new Directives().add("logs").append(
                    new Joined<>(
                        new Limited<Iterable<Directive>>(
                            Tv.TWENTY,
                            new RqUser(this.base, request).logs()
                        )
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:21,代码来源:TkLogs.java

示例4: act

import org.xembly.Directives; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
    return new RsPage(
        "/xsl/scripts.xsl",
        request,
        () -> new StickyList<>(
            new XeAppend("menu", "scripts"),
            new XeAppend("stripe_cents", "500"),
            new XeAppend(
                "stripe_key",
                Manifests.read("ThreeCopies-StripeKey")
            ),
            new XeDirectives(
                new Directives().add("scripts").append(
                    new Joined<>(
                        new RqUser(this.base, request).scripts()
                    )
                )
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:23,代码来源:TkScripts.java

示例5: recent

import org.xembly.Directives; //导入依赖的package包/类
/**
 * Recent artifacts..
 * @return List of them
 */
public Iterable<Iterable<Directive>> recent() {
    return new Mapped<>(
        item -> {
            final String[] parts = item.get("artifact").getS().split(":");
            return new Directives()
                .add("repo")
                .add("group").set(parts[0]).up()
                .add("artifact").set(parts[1]).up()
                .up();
        },
        this.table.frame()
            .where("good", "true")
            .through(
                new QueryValve()
                    .withScanIndexForward(false)
                    .withIndexName("recent")
                    .withConsistentRead(false)
                    // @checkstyle MagicNumber (1 line)
                    .withLimit(25)
                    .withAttributesToGet("artifact")
            )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:28,代码来源:Results.java

示例6: iterator

import org.xembly.Directives; //导入依赖的package包/类
@Override
public Iterator<Directive> iterator() {
    try {
        return new Directives()
            .attr(
                "date",
                ZonedDateTime.now().format(
                    DateTimeFormatter.ISO_INSTANT
                )
            )
            .attr("version", new Version().value())
            .iterator();
    } catch (final IOException ex) {
        throw new IllegalStateException(ex);
    }
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:17,代码来源:Header.java

示例7: iterator

import org.xembly.Directives; //导入依赖的package包/类
@Override
public Iterator<Directive> iterator() {
    return new Directives()
        .add("index")
        .attr("artifact", "unknown")
        .append(new Header())
        .append(
            new Joined<Directive>(
                new Mapped<>(
                    Index::metric,
                    new Filtered<Path>(
                        path -> path.getFileName().toString().matches(
                            "^[A-Z].+\\.xml$"
                        ),
                        new Directory(this.output)
                    )
                )
            )
        )
        .iterator();
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:22,代码来源:Index.java

示例8: xembly

import org.xembly.Directives; //导入依赖的package包/类
/**
 * Calculate Xembly for a single .class file.
 * @param ctc The class
 * @return Metrics
 */
private static Map.Entry<String, Directives> xembly(final CtClass ctc) {
    ctc.defrost();
    String pkg = ctc.getPackageName();
    if (pkg == null) {
        pkg = "";
    }
    return new MapEntry<>(
        pkg,
        new Directives()
            .add("class")
            .attr("id", ctc.getSimpleName())
            .append(Skeleton.details(ctc))
            .up()
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:21,代码来源:Skeleton.java

示例9: acceptsAndRenders

import org.xembly.Directives; //导入依赖的package包/类
@Test
public void acceptsAndRenders() throws Exception {
    final Path output = Files.createTempDirectory("").resolve("x2");
    final Path input = Paths.get(".");
    new App(input, output).analyze();
    final Mistakes mistakes = new Mistakes();
    mistakes.add(output);
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new Xembler(
                new Directives().add("metrics").append(
                    new Joined<Directive>(mistakes.worst())
                )
            ).xmlQuietly()
        ),
        XhtmlMatchers.hasXPath("/metrics/metric[@id='LCOM']/avg")
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:19,代码来源:MistakesTest.java

示例10: acceptsAndRenders

import org.xembly.Directives; //导入依赖的package包/类
@Test
public void acceptsAndRenders() throws Exception {
    final Path output = Files.createTempDirectory("").resolve("x2");
    final Path input = Paths.get(".");
    new App(input, output).analyze();
    final Results results = new Results();
    results.add("org.takes:takes", output);
    MatcherAssert.assertThat(
        XhtmlMatchers.xhtml(
            new Xembler(
                new Directives().add("repos").append(
                    new Joined<Directive>(results.recent())
                )
            ).xmlQuietly()
        ),
        XhtmlMatchers.hasXPath("/repos")
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:19,代码来源:ResultsTest.java

示例11: source

import org.xembly.Directives; //导入依赖的package包/类
/**
 * Convert event to Xembly.
 * @param domain The event
 * @return Xembly
 * @throws IOException If fails
 */
private static XeSource source(final Domain domain) throws IOException {
    final String name = domain.name();
    final Usage usage = domain.usage();
    return new XeDirectives(
        new Directives()
            .add("domain")
            .add("name").set(name).up()
            .add("usage").set(usage.total()).up()
            .append(
                new XeLink(
                    "delete",
                    new Href("/delete").with("name", name)
                ).toXembly()
            )
            .up()
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:24,代码来源:TkDomains.java

示例12: act

import org.xembly.Directives; //导入依赖的package包/类
@Override
public Response act(final Request req) throws IOException {
    final Iterable<Event> events = this.base.user(new RqUser(req).urn())
        .events()
        .iterate();
    return new RsPage(
        "/xsl/events.xsl",
        req,
        new XeAppend(
            "events",
            new XeChain(
                new XeTransform<>(
                    Iterables.limit(events, Tv.TWENTY),
                    TkEvents::source
                )
            ),
            new XeDirectives(
                new Directives().attr("total", Iterables.size(events))
            )
        )
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:23,代码来源:TkEvents.java

示例13: source

import org.xembly.Directives; //导入依赖的package包/类
/**
 * Convert event to Xembly.
 * @param event The event
 * @return Xembly
 * @throws IOException If fails
 */
private static XeSource source(final Event event) throws IOException {
    final Iterable<Directive> dirs = event.asXembly();
    final String title = new XePrint(dirs).text("{/event/title/text()}");
    return new XeDirectives(
        new Directives()
            .append(dirs)
            .append(
                new XeLink(
                    "delete",
                    new Href("/event-delete").with("title", title)
                ).toXembly()
            )
            .append(
                new XeLink(
                    "down",
                    new Href("/event-down").with("title", title)
                ).toXembly()
            )
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:27,代码来源:TkEvents.java

示例14: createConfigurationElement

import org.xembly.Directives; //导入依赖的package包/类
/**
 * Add the configuration element for a workflow action
 *
 * @param properties The configuration properties
 * @param directives The Xembly Directives object to which to add the new XML elements
 */
private void createConfigurationElement(Map<String, String> properties, Directives directives) {
    if (properties == null) {
        return;
    }

    directives.add("configuration");

    for (Map.Entry<String, String> entry : properties.entrySet()) {
        directives.add("property")
                .add("name")
                .set(entry.getKey())
                .up()
                .add("value")
                .set(entry.getValue())
                .up()
                .up();
    }
    directives.up();
}
 
开发者ID:etsy,项目名称:arbiter,代码行数:26,代码来源:OozieWorkflowGenerator.java

示例15: create

import org.xembly.Directives; //导入依赖的package包/类
@Override
@NotNull(message = "repo is never NULL")
public Repo create(
    @NotNull(message = "settings can't be NULL")
    final RepoCreate settings
) throws IOException {
    final Coordinates coords = new Coordinates.Simple(
        this.self,
        settings.name()
    );
    this.storage.apply(
        new Directives().xpath(this.xpath()).add("repo")
            .attr("coords", coords.toString())
            .add("name").set(settings.name()).up()
            .add("description").set("test repository").up()
            .add("private").set("false").up()
    );
    final Repo repo = this.get(coords);
    repo.patch(settings.json());
    Logger.info(
        this, "repository %s created by %s",
        coords, this.self
    );
    return repo;
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:26,代码来源:MkRepos.java


注:本文中的org.xembly.Directives类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。