Examples of regexp()


Examples of javax.validation.constraints.Max.regexp()

        if (helper.isAnnotationPresent(element, NotNull.class)) {
            property.setNotNullAnnotated(true);
        }
        if (helper.isAnnotationPresent(element, Pattern.class)) {
            Pattern a = (Pattern) helper.getAnnotation(element, Pattern.class);
            PatternFacet facet = new PatternFacet(a.regexp(), a.flags());
            property.addFacet(facet);
        }
        /* Example:
            @Pattern.List({
                @Pattern(regexp = "first_expression", message = "first.Pattern.message"),
View Full Code Here

Examples of javax.validation.constraints.Min.regexp()

        if (helper.isAnnotationPresent(element, NotNull.class)) {
            property.setNotNullAnnotated(true);
        }
        if (helper.isAnnotationPresent(element, Pattern.class)) {
            Pattern a = (Pattern) helper.getAnnotation(element, Pattern.class);
            PatternFacet facet = new PatternFacet(a.regexp(), a.flags());
            property.addFacet(facet);
        }
        /* Example:
            @Pattern.List({
                @Pattern(regexp = "first_expression", message = "first.Pattern.message"),
View Full Code Here

Examples of javax.validation.constraints.Pattern.regexp()

        if (helper.isAnnotationPresent(element, NotNull.class)) {
            property.setNotNullAnnotated(true);
        }
        if (helper.isAnnotationPresent(element, Pattern.class)) {
            Pattern a = (Pattern) helper.getAnnotation(element, Pattern.class);
            PatternFacet facet = new PatternFacet(a.regexp(), a.flags());
            property.addFacet(facet);
        }
        /* Example:
            @Pattern.List({
                @Pattern(regexp = "first_expression", message = "first.Pattern.message"),
View Full Code Here

Examples of javax.validation.constraints.Pattern.regexp()

    AnnotationDescriptor<Pattern> descriptor = new AnnotationDescriptor<Pattern>( Pattern.class );
    descriptor.setValue( "regexp", ".*" );

    Pattern pattern = AnnotationFactory.create( descriptor );

    assertEquals( ".*", pattern.regexp(), "Wrong parameter value" );
  }
}
View Full Code Here

Examples of org.elasticsearch.common.lucene.search.RegexpFilter.regexp()

        assertThat(parsedQuery, instanceOf(FilteredQuery.class));
        Filter filter = ((FilteredQuery) parsedQuery).getFilter();
        assertThat(filter, instanceOf(RegexpFilter.class));
        RegexpFilter regexpFilter = (RegexpFilter) filter;
        assertThat(regexpFilter.field(), equalTo("name.first"));
        assertThat(regexpFilter.regexp(), equalTo("s.*y"));
    }

    @Test
    public void testRegexpFilteredQueryWithMaxDeterminizedStates() throws IOException {
        IndexQueryParserService queryParser = queryParser();
View Full Code Here

Examples of org.elasticsearch.common.lucene.search.RegexpFilter.regexp()

        assertThat(parsedQuery, instanceOf(FilteredQuery.class));
        Filter filter = ((FilteredQuery) parsedQuery).getFilter();
        assertThat(filter, instanceOf(RegexpFilter.class));
        RegexpFilter regexpFilter = (RegexpFilter) filter;
        assertThat(regexpFilter.field(), equalTo("name.first"));
        assertThat(regexpFilter.regexp(), equalTo("s.*y"));
    }

    @Test
    public void testNamedRegexpFilteredQuery() throws IOException {
        IndexQueryParserService queryParser = queryParser();
View Full Code Here

Examples of org.elasticsearch.common.lucene.search.RegexpFilter.regexp()

        assertThat(parsedQuery.query(), instanceOf(FilteredQuery.class));
        Filter filter = ((FilteredQuery) parsedQuery.query()).getFilter();
        assertThat(filter, instanceOf(RegexpFilter.class));
        RegexpFilter regexpFilter = (RegexpFilter) filter;
        assertThat(regexpFilter.field(), equalTo("name.first"));
        assertThat(regexpFilter.regexp(), equalTo("s.*y"));
    }

    @Test
    public void testRegexpWithFlagsFilteredQuery() throws IOException {
        IndexQueryParserService queryParser = queryParser();
View Full Code Here

Examples of org.elasticsearch.common.lucene.search.RegexpFilter.regexp()

        assertThat(parsedQuery.query(), instanceOf(FilteredQuery.class));
        Filter filter = ((FilteredQuery) parsedQuery.query()).getFilter();
        assertThat(filter, instanceOf(RegexpFilter.class));
        RegexpFilter regexpFilter = (RegexpFilter) filter;
        assertThat(regexpFilter.field(), equalTo("name.first"));
        assertThat(regexpFilter.regexp(), equalTo("s.*y"));
        assertThat(regexpFilter.flags(), equalTo(INTERSECTION.value() | COMPLEMENT.value() | EMPTY.value()));
    }

    @Test
    public void testNamedAndCachedRegexpWithFlagsFilteredQuery() throws IOException {
View Full Code Here

Examples of org.elasticsearch.common.lucene.search.RegexpFilter.regexp()

        CacheKeyFilter.Wrapper wrapper = (CacheKeyFilter.Wrapper) filter;
        assertThat(new BytesRef(wrapper.cacheKey().bytes()).utf8ToString(), equalTo("key"));
        assertThat(wrapper.wrappedFilter(), instanceOf(RegexpFilter.class));
        RegexpFilter regexpFilter = (RegexpFilter) wrapper.wrappedFilter();
        assertThat(regexpFilter.field(), equalTo("name.first"));
        assertThat(regexpFilter.regexp(), equalTo("s.*y"));
        assertThat(regexpFilter.flags(), equalTo(INTERSECTION.value() | COMPLEMENT.value() | EMPTY.value()));
    }

    @Test
    public void testRegexpBoostQuery() throws IOException {
View Full Code Here

Examples of org.internna.iwebmvc.core.validation.annotation.StringConstraint.regexp()

    protected Set<ValidationError> validateStringConstraint(final Field field, final Object object) {
        final StringConstraint stringConstraint = field.getAnnotation(StringConstraint.class);
        Set<ValidationError> errors = new HashSet<ValidationError>();
        if (stringConstraint != null) {
            if (stringConstraint.required() & (object == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], stringConstraint, object));
            if ((object != null) & (stringConstraint.regexp().length() > 0)) {
                try {
                    Pattern pattern = Pattern.compile(stringConstraint.regexp());
                    Matcher matcher = pattern.matcher(object.toString());
                    if (!matcher.matches()) errors.add(new ValidationError(field.getName(), errorCodes[1], stringConstraint, object));
                } catch (Exception ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.