• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java And类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: numericRange

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
protected Container.Filter numericRange(Object propertyId, Class<?> numberClass, String pattern) {
    Matcher matcher = numericRangePattern.matcher(pattern);
    if (!matcher.find()) return null;
    String left = matcher.group(1);
    String right = matcher.group(2);

    if (fpPattern.matcher(left).matches() && fpPattern.matcher(right).matches()) {

        Number i = parseNumericValue(left, numberClass);
        Number j = parseNumericValue(right, numberClass);

        if (i.doubleValue() > j.doubleValue()) {
            throw new Validator.InvalidValueException(
                    String.format("The given range '%s' is invalid", pattern));
        }

        return new And(
                new Compare.GreaterOrEqual(propertyId, i),
                new Compare.LessOrEqual(propertyId, j)
        );
    }

    return null;
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:25,代码来源:DefaultFilterFactory.java


示例2: testDate_dd_mm

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDate_dd_mm() {

    DateTime today = DateTime.now();
    int year = today.getYear();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java


示例3: testDate_dd_mm_Range

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDate_dd_mm_Range() {

    DateTime today = DateTime.now();
    int year = today.getYear();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, 1, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01..31-01");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java


示例4: testDate_dd

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDate_dd() {

    DateTime today = DateTime.now();
    int year = today.getYear(), month = today.getMonthOfYear();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, month, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, month, 1, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:18,代码来源:TestDefaultFilterFactory.java


示例5: testDate_dd_Range

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDate_dd_Range() {

    DateTime today = DateTime.now();
    int year = today.getYear(), month = today.getMonthOfYear();
    int maxDay = today.dayOfMonth().getMaximumValue();

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(year, month, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(year, month, maxDay, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01.." + maxDay);


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:19,代码来源:TestDefaultFilterFactory.java


示例6: filterToString

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
public String filterToString(Container.Filter filter) {
    if (filter instanceof Compare.LessOrEqual) {
        return String.format("%s <= %s", ((Compare.LessOrEqual) filter).getPropertyId(), ((Compare.LessOrEqual) filter).getValue());
    } else
    if (filter instanceof Compare.GreaterOrEqual) {
        return String.format("%s >= %s", ((Compare.GreaterOrEqual) filter).getPropertyId(), ((Compare.GreaterOrEqual) filter).getValue());
    } else
    if (filter instanceof And) {
        StringBuffer sb = new StringBuffer();
        Collection<Container.Filter> coll = ((And) filter).getFilters();
        for (Container.Filter f: coll) {
            sb.append(filterToString(f));
            sb.append(", ");
        }
        return sb.toString();
    }

    throw new UnsupportedOperationException("unsupported filter");
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:20,代码来源:TestDefaultFilterFactory.java


示例7: testSize_WriteThrough

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
    public void testSize_WriteThrough() {
        QPerson person = QPerson.person;
        expect(
                entityProviderMock.getEntityCount(container, new And(new Equal(
                        "firstName", "Hello"), new Equal("lastName", "World"))))
                .andReturn(123);
        replay(entityProviderMock);

        assertTrue(container.isApplyFiltersImmediately());
//        container.addContainerFilter(new Equal("firstName", "Hello"));
//        container.addContainerFilter(new Equal("lastName", "World"));
        container.addContainerFilter(person.firstName.eq("Hello"));
        container.addContainerFilter(person.lastName.eq("World"));
        container.setEntityProvider(entityProviderMock);
        container.setWriteThrough(true);

        assertEquals(123, container.size());

        verify(entityProviderMock);
    }
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:22,代码来源:QuerydslJPAContainerExtTest.java


示例8: testSize_WriteThrough

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testSize_WriteThrough() {
    expect(
            entityProviderMock.getEntityCount(container, new And(new Equal(
                    "firstName", "Hello"), new Equal("lastName", "World"))))
            .andReturn(123);
    replay(entityProviderMock);

    assertTrue(container.isApplyFiltersImmediately());
    container.addContainerFilter(new Equal("firstName", "Hello"));
    container.addContainerFilter(new Equal("lastName", "World"));
    container.setEntityProvider(entityProviderMock);
    container.setWriteThrough(true);

    assertEquals(123, container.size());

    verify(entityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:19,代码来源:QuerydslJPAContainerTest.java


示例9: testGetChildren_Filtered

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testGetChildren_Filtered() {
    LinkedList<SortBy> orderby = new LinkedList<SortBy>();
    orderby.add(new SortBy("firstName", true));

    LinkedList<Object> result = new LinkedList<Object>();

    // Instruct mocks
    expect(
            entityProviderMock.getAllEntityIdentifiers(container, new And(new Equal(
                    "manager.id", 123l), new Equal("firstName", "blah")),
                    orderby)).andReturn(result);
    replay(entityProviderMock);

    // Set up container
    container.setParentProperty("manager");
    container.setEntityProvider(entityProviderMock);
    container.sort(new Object[] { "firstName" }, new boolean[] { true });
    container.addContainerFilter(new Equal("firstName", "blah"));

    // Run test
    assertSame(result, container.getChildren(123l));

    // Verify
    verify(entityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:27,代码来源:QuerydslJPAContainerTest.java


示例10: isAuthorizationValid

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
public boolean isAuthorizationValid(String email, String password) {
    /*try{
    	String queryString = "SELECT * FROM user WHERE email like '" + email + "' AND password like '" + password + "'" ;
    	FreeformQuery query = new FreeformQuery(queryString, connectionPool);
    	SQLContainer result = new SQLContainer(query);
    	for (Object ob : result.getItemIds()) {
            if ((result.getItem(ob).getItemProperty("email").getValue().equals(email)) &&
                    (result.getItem(ob).getItemProperty("password").getValue().equals(password)))
                return true;
        }
    } catch(Exception e){
    	e.printStackTrace();
    }
	*/
	
	userContainer.addContainerFilter(new And(new Equal("email", email), new Equal("password", password)));
	
	/*addContainerFilter( new Or(new And(new Equal("NAME", "Paul"),
		                   new A(new Less("AGE", 18),
		                          new Greater("AGE", 65))),
		           new Like("NAME", "A%")));
    */
    return false;
}
 
开发者ID:mwolski89,项目名称:own-music-cloud,代码行数:25,代码来源:DatabaseHelper.java


示例11: filter

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
private void filter(String filterString) {
    container.removeAllContainerFilters();
    if (filterString.length() > 0) {
        String[] filterWords = filterString.split(" ");
        Container.Filter[] filters = new Container.Filter[filterWords.length];
        for (int i = 0; i < filterWords.length; ++i) {
            String word = filterWords[i];
            filters[i] = new Or(
                    new SimpleStringFilter("stringProperty", word, false, false),
                    new SimpleStringFilter("integerProperty", word, true, true),
                    new SimpleStringFilter("embeddedProperty.enumProperty", word, true, false)
            );
        }
        container.addContainerFilter(new And(filters));
    }
}
 
开发者ID:peholmst,项目名称:vaadin-mockapp,代码行数:17,代码来源:SampleTableView.java


示例12: addShowPopulatedFilter

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
protected void addShowPopulatedFilter(String propertyId, HeaderRow filterRow) {
    HeaderCell cell = filterRow.getCell(propertyId);
    CheckBox group = new CheckBox("Show Set Only");
    group.setImmediate(true);
    group.addValueChangeListener(l->{
        container.removeContainerFilters(propertyId);
        if (group.getValue()) {
            container.addContainerFilter(new And(new Not(new Compare.Equal(propertyId,"")), new Not(new IsNull(propertyId))));
        }
    });
    group.addStyleName(ValoTheme.CHECKBOX_SMALL);
    cell.setComponent(group);
    
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:15,代码来源:EditExcelReaderPanel.java


示例13: testIntRange

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testIntRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(INT_PROPID, 10),
            new Compare.LessOrEqual(INT_PROPID, 100));

    Container.Filter filter = filterFactory.createFilter(int.class, INT_PROPID, "10..100");
    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:12,代码来源:TestDefaultFilterFactory.java


示例14: testDoubleRange

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDoubleRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(INT_PROPID, 10.1),
            new Compare.LessOrEqual(INT_PROPID, 100.2));

    Container.Filter filter = filterFactory.createFilter(double.class, INT_PROPID, "10.1..100.2");
    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:12,代码来源:TestDefaultFilterFactory.java


示例15: testDateYear

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDateYear() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2014, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2014, 12, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "2014");
    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:12,代码来源:TestDefaultFilterFactory.java


示例16: testDateYearRange

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDateYearRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2015, 12, 31, 23, 59, 59, 999).toDate()));
    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "2010..2015");

    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:10,代码来源:TestDefaultFilterFactory.java


示例17: testDateMonth

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDateMonth() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2010, 1, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-2010");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);

}
 
开发者ID:tyl,项目名称:field-binder,代码行数:15,代码来源:TestDefaultFilterFactory.java


示例18: testDateMonthRange

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDateMonthRange() {
    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2015, 10, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-2010..10-2015");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);

}
 
开发者ID:tyl,项目名称:field-binder,代码行数:15,代码来源:TestDefaultFilterFactory.java


示例19: testDate_dd_mm_yyyy

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDate_dd_mm_yyyy() {

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01-2010");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:15,代码来源:TestDefaultFilterFactory.java


示例20: testDate_dd_mm_yyyy_Range

import com.vaadin.data.util.filter.And; //导入依赖的package包/类
@Test
public void testDate_dd_mm_yyyy_Range() {

    Container.Filter expected = new And(
            new Compare.GreaterOrEqual(DATE_PROPID, new DateTime(2010, 1, 1, 0, 0, 0).toDate()),
            new Compare.LessOrEqual(DATE_PROPID, new DateTime(2010, 1, 31, 23, 59, 59, 999).toDate()));

    Container.Filter filter = filterFactory.createFilter(Date.class, DATE_PROPID, "01-01-2010..31-01-2010");


    log.info(filterToString(expected));
    log.info(filterToString(filter));
    assertEquals(expected, filter);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:15,代码来源:TestDefaultFilterFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TimelineClient类代码示例发布时间:2022-05-22
下一篇:
Java GenericExceptionMessage类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap