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


Java Text类代码示例

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


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

示例1: checkFormat

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
private void checkFormat(final String expected, final Object object, final Locale locale, final String flag)
{
    final Arguments arguments;
    if (flag == null)
    {
        arguments = Arguments.NONE;
    }
    else
    {
        arguments = toArgs(arg(flag));
    }

    final Component component = stringFormatter.format(object, createContext(locale), arguments);

    Assert.assertTrue(component instanceof Text);
    Assert.assertEquals(expected, ((Text)component).getText());
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:18,代码来源:StringFormatterTest.java

示例2: checkFormat

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
private void checkFormat(final String expected, final Locale locale, final String argument)
{
    final Arguments arguments;
    if (argument == null)
    {
        arguments = Arguments.NONE;
    }
    else
    {
        arguments = toArgs(arg(argument));
    }

    final Component component = staticTextFormatter.format(createContext(locale), arguments);

    Assert.assertTrue(component instanceof Text);
    Assert.assertEquals(expected, ((Text)component).getText());
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:18,代码来源:StaticTextFormatterTest.java

示例3: checkFormat

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
private void checkFormat(final String expected, final Number number, final Locale locale)
{
    final Component component = currencyFormatter.format(number, createContext(locale), Arguments.NONE);

    Assert.assertTrue(component instanceof Text);
    Assert.assertEquals(expected, ((Text)component).getText());
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:8,代码来源:CurrencyFormatterTest.java

示例4: checkFormat

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
private void checkFormat(final String expected, final Number number, final Locale locale)
{
    final Component component = percentFormatter.format(number, createContext(locale), Arguments.NONE);

    Assert.assertTrue(component instanceof Text);
    Assert.assertEquals(expected, ((Text)component).getText());
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:8,代码来源:PercentFormatterTest.java

示例5: checkFormat

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
private void checkFormat(final String expected, final Number number, final Locale locale)
{
    final Component component = integerFormatter.format(number, createContext(locale), Arguments.NONE);

    Assert.assertTrue(component instanceof Text);
    Assert.assertEquals(expected, ((Text)component).getText());
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:8,代码来源:IntegerFormatterTest.java

示例6: checkFormat

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
private void checkFormat(final String expected, final Number number, final Locale locale, final Currency currency,
                         final String mode, final String value)
{
    final Context context = createContext(LOCALE.with(locale), CURRENCY.with(currency));
    final Arguments args = args(mode, value);
    final Component component = numberFormatter.format(number, context, args);

    Assert.assertTrue(component instanceof Text);
    Assert.assertEquals(expected, ((Text)component).getText());
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:11,代码来源:NumberFormatterTest.java

示例7: checkFormat

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
private void checkFormat(final String expected, final Date date, final Locale locale, final TimeZone timeZone,
                         final String defaultStyle, final String dateStyle, final String timeStyle,
                         final String format)
{
    final Context context = createContext(Contexts.LOCALE.with(locale), Contexts.TIMEZONE.with(timeZone));
    final Arguments args = createArguments(defaultStyle, dateStyle, timeStyle, format);

    final Component component = formatter.format(date, context, args);

    Assert.assertTrue(component instanceof Text);
    Assert.assertEquals(expected, ((Text)component).getText());
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:13,代码来源:AbstractDateTimeFormatterTest.java

示例8: main

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
public static void main(String[] args)
{
    List<Class<?>> classes = asList(Parser.class, Macro.class, Element.class, DefaultMacro.class, NamedMacro.class,
                                    IndexedDefaultMacro.class, Indexed.class, CompleteMacro.class, Pattern.class,
                                    Matcher.class, Text.class, TextComponent.class, Component.class);
    System.out.println("Classes:");
    System.out.println(classes);
    String msg = "text and a macro {1:name#with index and comment:and parameter=with value:multiple:and one=more} more text";
    long start, delta;
    long values = 0;
    double avg = 0;
    int printAt = 1;

    for (int i = 0; i < 100000000; i++)
    {
        start = System.nanoTime();
        Parser.parse(msg);
        delta = System.nanoTime() - start;
        avg = (avg * values + delta) / (values + 1);
        values++;
        if (i == printAt - 1 || i < 10)
        {
            System.out.println("Time at " + (i + 1) + ": " + (avg / 1000d) + "µs");
            values = 0;
            avg = 0;
            if (i == printAt - 1) printAt *= 10;
        }
    }
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:30,代码来源:SimpleColdToHot.java

示例9: testPostProcessorAtFormatterLevel

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
@Test
public void testPostProcessorAtFormatterLevel() throws Exception
{
    Formatter<?> integerFormatter = new IntegerFormatter().addPostProcessor(new WrappingPostProcessor("<", ">"));
    Formatter<?> staticTextFormatter = new StaticTextFormatter().addPostProcessor(
        new WrappingPostProcessor(Text.EMPTY, Text.create("(!)")));

    Dirigent<String> dirigent = new StringBuilderDirigent().registerFormatter(integerFormatter).registerFormatter(
        staticTextFormatter).registerFormatter(new NumberFormatter());

    Assert.assertEquals("some text <42>, 42.435 and some static text(!).",
                        dirigent.compose(Contexts.createContext(Locale.US),
                                         "some text {integer}, {0:number} and some {text:static text}.", 42.43522));
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:15,代码来源:StringBuilderDirigentTest.java

示例10: format

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
@Override
public Component format(Region region, Context context, Arguments args)
{
    return new Text(region.getName() == null ? region.getWorld() == null ? "global" : region.getWorld().getName() : region.getName());
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:6,代码来源:RegionFormatter.java

示例11: format

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
@Format
public Component format(FileSubject object)
{
    return new Text(object.getIdentifier());
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:6,代码来源:RoleFormatter.java

示例12: format

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
@Override
protected Component format(Object input, Context context, Arguments args)
{
    return new Text(parseObjectToString(input, context.get(LOCALE), args));
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:6,代码来源:StringFormatter.java

示例13: format

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
@Override
protected Component format(Date input, Context context, Arguments args)
{
    return new Text(parseDateToString(input, context, args));
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:6,代码来源:DateTimeFormatter.java

示例14: format

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
@Override
protected Component format(Number input, Context context, Arguments args)
{
    return new Text(parseNumberToString(input, context, args));
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:6,代码来源:NumberFormatter.java

示例15: format

import org.cubeengine.dirigent.parser.Text; //导入依赖的package包/类
@Override
public Component format(Context context, Arguments args)
{
    return new Text(args.get(0));
}
 
开发者ID:CubeEngine,项目名称:Dirigent,代码行数:6,代码来源:StaticTextFormatter.java


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