Package com.mysema.query.types

Examples of com.mysema.query.types.Path


                {
                    return new Value( param( ((ParamExpression) expression).getName() ) );
                }
                else if ( expression instanceof Path )
                {
                    Path path = (Path) expression;
                    return new Value( identifier( path.getRoot() ).string( path.getMetadata().getElement()
                            .toString() ) );
                }
                else
                {
                    throw new IllegalArgumentException( "Unknown argument type:" + expression );
View Full Code Here


            Map<Path<?>, Object> values = new HashMap<Path<?>, Object>();
            Class<?> beanClass = bean.getClass();
            Map<String, Path<?>> columns = getColumns(entity);
            for (Field beanField : ReflectionUtils.getFields(beanClass)) {
                if (!Modifier.isStatic(beanField.getModifiers()) && columns.containsKey(beanField.getName())) {
                    @SuppressWarnings("rawtypes")
                    Path path = columns.get(beanField.getName());
                    beanField.setAccessible(true);
                    Object propertyValue = beanField.get(bean);
                    if (propertyValue != null) {
                        values.put(path, propertyValue);
View Full Code Here

        Map<String, Object> map = new BeanMap(bean);
        Map<String, Path<?>> columns = getColumns(entity);
        for (Map.Entry entry : map.entrySet()) {
            String property = entry.getKey().toString();
            if (!property.equals("class") && columns.containsKey(property)) {
                Path path = columns.get(property);
                if (entry.getValue() != null) {
                    values.put(path, entry.getValue());
                } else if (withNullBindings && !isPrimaryKeyColumn(entity, path)) {
                    values.put(path, Null.DEFAULT);
                }
View Full Code Here

    }

    @Test
    @SuppressWarnings("rawtypes")
    public void IndexOf() {       
        Path path = QCat.cat.name;
        Expression startIndex = Expressions.constant(0);
        Expression endIndex = NumberOperation.create(Integer.class, Ops.INDEX_OF, path, Expressions.constant("x"));
        Expression substr = StringOperation.create(Ops.SUBSTR_2ARGS, path, startIndex, endIndex);
        assertToString("substring(cat.name,1,locate(?1,cat.name)-1)", substr);
    }
View Full Code Here

    private Path<?> normalizePath(Path<?> expr) {
        Context context = new Context();
        Path<?> replaced = (Path<?>)expr.accept(CollectionAnyVisitor.DEFAULT, context);
        if (!replaced.equals(expr)) {
            for (int i = 0; i < context.paths.size(); i++) {
                Path path = context.paths.get(i).getMetadata().getParent();
                Path replacement = context.replacements.get(i);
                this.innerJoin(path, replacement);
            }
            return replaced;
        } else {
            return expr;
View Full Code Here

        paths.add(new SimplePath(String.class, parent, "p"));
        paths.add(new StringPath(parent, "p"));
        paths.add(new TimePath(Time.class, parent, "p"));

        for (Path<?> path : paths) {
            Path other = new PathImpl(path.getType(), PathMetadataFactory.forProperty(parent, "p"));
            assertEquals(path.toString(), path.accept(ToStringVisitor.DEFAULT, Templates.DEFAULT));
            assertEquals(path.hashCode(), other.hashCode());
            assertEquals(path, other);
            assertNotNull(path.getMetadata());
            assertNotNull(path.getType());
            assertEquals(parent, path.getRoot());
        }
View Full Code Here

        paths.add(new SimplePath(String.class,"p"));
        paths.add(new StringPath("p"));
        paths.add(new TimePath(Time.class,"p"));

        for (Path<?> path : paths) {
            Path other = new PathImpl(path.getType(), "p");
            assertEquals(path.toString(), path.accept(ToStringVisitor.DEFAULT, null));
            assertEquals(path.hashCode(), other.hashCode());
            assertEquals(path, other);
            assertNotNull(path.getMetadata());
            assertNotNull(path.getType());
            assertEquals(path, path.getRoot());
        }
View Full Code Here

        paths.add(new SimplePath(String.class,"p"));
        paths.add(new StringPath("p"));
        paths.add(new TimePath(Time.class,"p"));

        for (DslExpression<?> expr : paths) {
            Path o = new PathImpl(expr.getType(), "o");
            assertEquals(OperationImpl.create(expr.getType(), Ops.ALIAS, expr, o), expr.as("o"));
            Path p = new PathImpl(expr.getType(), "p");
            assertEquals(OperationImpl.create(expr.getType(), Ops.ALIAS, expr, p), expr.as(p));
        }
    }
View Full Code Here

TOP

Related Classes of com.mysema.query.types.Path

Copyright © 2018 www.massapicom. 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.