當前位置: 首頁>>代碼示例>>Java>>正文


Java Default類代碼示例

本文整理匯總了Java中org.tomitribe.crest.api.Default的典型用法代碼示例。如果您正苦於以下問題:Java Default類的具體用法?Java Default怎麽用?Java Default使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Default類屬於org.tomitribe.crest.api包,在下文中一共展示了Default類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: rsync

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
// CHECKSTYLE:OFF
public void rsync(@Option("recursive") final boolean recursive,
                  @Option("links") final boolean links,
                  @Option("perms") final boolean perms,
                  @Option("owner") final boolean owner,
                  @Option("group") final boolean group,
                  @Option("devices") final boolean devices,
                  @Option("specials") final boolean specials,
                  @Option("times") final boolean times,
                  @Option("exclude") final Pattern exclude,
                  @Option("exclude-from") final File excludeFrom,
                  @Option("include") final Pattern include,
                  @Option("include-from") final File includeFrom,
                  @Option("progress") @Default("true") final boolean progress,
                  final URI[] sources,
                  final URI dest)
{

    // TODO write the implementation...
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:22,代碼來源:AnyName.java

示例2: rsync

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void rsync(@Option("recursive") final boolean recursive,
                  @Option("links") final boolean links,
                  @Option("perms") final boolean perms,
                  @Option("owner") final boolean owner,
                  @Option("group") final boolean group,
                  @Option("devices") final boolean devices,
                  @Option("specials") final boolean specials,
                  @Option("times") final boolean times,
                  Patterns patterns,
                  @Option("progress") @Default("true") final boolean progress,
                  final URI[] sources,
                  final URI dest
) {

}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:17,代碼來源:HelpWithInnerOptionsTest.java

示例3: test

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void test(@Option("recursive") final boolean recursive,
                 @Option("links") final boolean links,
                 @Option("perms") final boolean perms,
                 @Option("owner") @Default("${user.name}") final String owner,
                 @Option("group") final boolean group,
                 @Option("devices") final boolean devices,
                 @Option("specials") final boolean specials,
                 @Option("times") final boolean times,
                 Patterns patterns,
                 @Option("highlight") @Default("orange") final Color highlight,
                 @Option("foreground") @Default("orange") final Color foreground,
                 @Option("background") final Color background,
                 final URI source,
                 final URI dest
) {

}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:19,代碼來源:HelpWithInnerOptionsTest.java

示例4: doAll

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doAll(
        @Option("byte") @Default("42") final byte byteValue,
        @Option("char") @Default("D") final char charValue,
        @Option("boolean") @Default("true") final boolean booleanValue,
        @Option("short") @Default("1024") final short shortValue,
        @Option("int") @Default("3301976") final int intValue,
        @Option("long") @Default("10000000000") final long longValue,
        @Option("float") @Default("10.0") final float floatValue,
        @Option("double") @Default("20.0") final double doubleValue
) {
    assertEquals(defaultByte, byteValue);
    assertEquals(defaultChar, charValue);
    assertEquals(defaultBoolean, booleanValue);
    assertEquals(defaultShort, shortValue);
    assertEquals(defaultInt, intValue);
    assertEquals(defaultLong, longValue);
    assertEquals(defaultFloat, floatValue);
    assertEquals(defaultDouble, doubleValue);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:21,代碼來源:ExplicitPrimitiveOptionDefaultsTest.java

示例5: rsync

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void rsync(@Option("recursive") final boolean recursive,
                  @Option("links") final boolean links,
                  @Option("perms") final boolean perms,
                  @Option("owner") final boolean owner,
                  @Option("group") final boolean group,
                  @Option("devices") final boolean devices,
                  @Option("specials") final boolean specials,
                  @Option("times") final boolean times,
                  @Option("exclude") final Pattern exclude,
                  @Option("exclude-from") final File excludeFrom,
                  @Option("include") final Pattern include,
                  @Option("include-from") final File includeFrom,
                  @Option({"progress", "p"}) @Default("true") final boolean progress,
                  final URI[] sources,
                  final URI dest
) {

}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:20,代碼來源:HelpTest.java

示例6: test

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void test(@Option({"r", "recursive"}) final boolean recursive,
                 @Option({"links", "l"}) final boolean links,
                 @Option({"p", "perms"}) final boolean perms,
                 @Option("owner") @Default("${user.name}") final String owner,
                 @Option("group") final boolean group,
                 @Option("devices") final boolean devices,
                 @Option("specials") final boolean specials,
                 @Option("times") final boolean times,
                 @Option("x") final boolean x,
                 @Option({"exclude", "e"}) final Pattern exclude,
                 @Option("exclude-from") final File excludeFrom,
                 @Option("include") @Default(".*") final Pattern include,
                 @Option("include-from") final File includeFrom,
                 @Option("highlight") @Default("orange") final Color highlight,
                 @Option("foreground") @Default("orange") final Color foreground,
                 @Option({"background", "bg"}) final Color background,
                 final URI source,
                 final URI dest
) {

}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:23,代碼來源:HelpTest.java

示例7: doAllExplicit

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doAllExplicit(
        @Option("user-home") @Default("${user.home}") final Value defaultParameter,
        @Option("directory") @Default("${user.home}\u0000${user.dir}") final Value[] defaultParameters,
        @Option("format") final Value explicitParameter,
        @Option("pattern") final Value[] explicitParameters,
        final Value explicitArgument,
        final Value[] explicitArguments
) {

    // Explicit values are NOT interpreted
    final Value userHome = new Value("${user.home}");
    final Value userDir = new Value("${user.dir}");

    assertEquals(userHome, defaultParameter);
    assertEquals(userHome, defaultParameters[0]);
    assertEquals(userDir, defaultParameters[1]);

    assertEquals(userHome, explicitParameter);
    assertEquals(userHome, explicitParameters[0]);
    assertEquals(userDir, explicitParameters[1]);

    assertEquals(userHome, explicitArgument);
    assertEquals(userHome, explicitArguments[0]);
    assertEquals(userDir, explicitArguments[1]);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:27,代碼來源:DefaultSubstitutionTest.java

示例8: findDupes

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void findDupes(@Option("pattern") List<String> patterns,
        @Option("path") List<String> paths,
        @Option("verbose") @Default("false") boolean verbose,
        @Option("show-timings") @Default("false") boolean showTimings) {

    if (verbose) {
        System.out.println("Scanning for duplicate files.");
        System.out.println("Search paths:");
        paths.forEach(p -> System.out.println("\t" + p));
        System.out.println("Search patterns:");
        patterns.forEach(p -> System.out.println("\t" + p));
        System.out.println();
    }

    final Instant startTime = Instant.now();
    FileFinder ff = new FileFinder();
    patterns.forEach(p -> ff.addPattern(p));
    paths.forEach(p -> ff.addPath(p));

    ff.find();

    System.out.println("The following duplicates have been found:");
    java.math.BigInteger b;
    final AtomicInteger group = new AtomicInteger(1);
    ff.getDuplicates().forEach((name, list) -> {
        System.out.printf("Group #%d:%n", group.getAndIncrement());
        list.forEach(fileInfo -> System.out.println("\t" + fileInfo.getPath()));
    });
    final Instant endTime = Instant.now();

    if (showTimings) {
        Duration duration = Duration.between(startTime, endTime);
        long hours = duration.toHours();
        long minutes = duration.minusHours(hours).toMinutes();
        long seconds = duration.minusHours(hours).minusMinutes(minutes).toMillis() / 1000;
        System.out.println(String.format("%nThe scan took %d hours, %d minutes, and %d seconds.%n", hours, minutes, seconds));
    }
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:40,代碼來源:DupeFinderCommands.java

示例9: validate

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
private void validate() {
    for (final Param param : spec.arguments) {
        if (param.isAnnotationPresent(Default.class)) {
            throw new IllegalArgumentException("@Default only usable with @Option parameters.");
        }
        if (!param.isListable() && param.isAnnotationPresent(Required.class)) {
            throw new IllegalArgumentException("@Required only usable with @Option parameters and lists.");
        }
    }
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:11,代碼來源:CmdMethod.java

示例10: doByte

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doByte(@Option("foo") @Default("2,3,5") final List<Byte> list, @Option("color") final Color colorParam, final Color colorArg) {
    assertNotNull(list);

    final Iterator<Byte> it = list.iterator();
    assertEquals((Byte) (byte) 2, it.next());
    assertEquals((Byte) (byte) 3, it.next());
    assertEquals((Byte) (byte) 5, it.next());
    assertFalse(it.hasNext());

    assertEquals(Color.orange, colorParam);
    assertEquals(Color.green, colorArg);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:14,代碼來源:DefaultOptionListsAndOptionsTest.java

示例11: doBoolean

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doBoolean(@Option("foo") @Default("false,true,false") final List<Boolean> list, @Option("color") final Color colorParam, final Color colorArg) {
    assertNotNull(list);

    final Iterator<Boolean> it = list.iterator();
    assertEquals(Boolean.FALSE, it.next());
    assertEquals(Boolean.TRUE, it.next());
    assertEquals(Boolean.FALSE, it.next());
    assertFalse(it.hasNext());

    assertEquals(Color.orange, colorParam);
    assertEquals(Color.green, colorArg);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:14,代碼來源:DefaultOptionListsAndOptionsTest.java

示例12: doCharacter

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doCharacter(@Option("foo") @Default("2,3,5") final List<Character> list, @Option("color") final Color colorParam, final Color colorArg) {
    assertNotNull(list);

    final Iterator<Character> it = list.iterator();
    assertEquals((Character) '2', it.next());
    assertEquals((Character) '3', it.next());
    assertEquals((Character) '5', it.next());
    assertFalse(it.hasNext());

    assertEquals(Color.orange, colorParam);
    assertEquals(Color.green, colorArg);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:14,代碼來源:DefaultOptionListsAndOptionsTest.java

示例13: doShort

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doShort(@Option("foo") @Default("2,3,5") final List<Short> list, @Option("color") final Color colorParam, final Color colorArg) {
    assertNotNull(list);

    final Iterator<Short> it = list.iterator();
    assertEquals((Short) (short) 2, it.next());
    assertEquals((Short) (short) 3, it.next());
    assertEquals((Short) (short) 5, it.next());
    assertFalse(it.hasNext());

    assertEquals(Color.orange, colorParam);
    assertEquals(Color.green, colorArg);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:14,代碼來源:DefaultOptionListsAndOptionsTest.java

示例14: doInt

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doInt(@Option("foo") @Default("2,3,5") final List<Integer> list, @Option("color") final Color colorParam, final Color colorArg) {
    assertNotNull(list);

    final Iterator<Integer> it = list.iterator();
    assertEquals((Integer) 2, it.next());
    assertEquals((Integer) 3, it.next());
    assertEquals((Integer) 5, it.next());
    assertFalse(it.hasNext());

    assertEquals(Color.orange, colorParam);
    assertEquals(Color.green, colorArg);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:14,代碼來源:DefaultOptionListsAndOptionsTest.java

示例15: doLong

import org.tomitribe.crest.api.Default; //導入依賴的package包/類
@Command
public void doLong(@Option("foo") @Default("2,3,5") final List<Long> list, @Option("color") final Color colorParam, final Color colorArg) {
    assertNotNull(list);

    final Iterator<Long> it = list.iterator();
    assertEquals((Long) (long) 2, it.next());
    assertEquals((Long) (long) 3, it.next());
    assertEquals((Long) (long) 5, it.next());
    assertFalse(it.hasNext());

    assertEquals(Color.orange, colorParam);
    assertEquals(Color.green, colorArg);
}
 
開發者ID:tomitribe,項目名稱:crest,代碼行數:14,代碼來源:DefaultOptionListsAndOptionsTest.java


注:本文中的org.tomitribe.crest.api.Default類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。