Package org.modeshape.jcr.query.RowExtractors

Examples of org.modeshape.jcr.query.RowExtractors.ExtractFromRow


        } catch (NoSuchElementException e) {
            if (defaultType == null) throw e;
        }
        final TypeFactory<?> typeFactory = expectedType != null ? context.getTypeSystem().getTypeFactory(expectedType) : defaultType;
        if (allowMultiValued) {
            return new ExtractFromRow() {
                @Override
                public Object getValueInRow( RowAccessor row ) {
                    CachedNode node = row.getNode(indexInRow);
                    if (node == null) return null;
                    org.modeshape.jcr.value.Property prop = node.getProperty(propName, cache);
                    if (prop == null || prop.isEmpty()) return null;
                    if (prop.isSingle()) {
                        return typeFactory.create(prop.getFirstValue());
                    }
                    assert prop.isMultiple();
                    Object[] result = new Object[prop.size()];
                    int i = -1;
                    for (Object value : prop) {
                        result[++i] = typeFactory.create(value);
                    }
                    return result;
                }

                @Override
                public TypeFactory<?> getType() {
                    return typeFactory;
                }

                @Override
                public String toString() {
                    return "(" + selectorName + "." + propertyName + ")";
                }
            };
        }
        return new ExtractFromRow() {
            @Override
            public Object getValueInRow( RowAccessor row ) {
                CachedNode node = row.getNode(indexInRow);
                if (node == null) return null;
                org.modeshape.jcr.value.Property prop = node.getProperty(propName, cache);
View Full Code Here


        // Find the expected property type of the value ...
        assert columns != null;
        final int indexInRow = columns.getSelectorIndex(selectorName);
        final TypeFactory<?> typeFactory = context.getTypeSystem().getStringFactory();
        final boolean trace = LOGGER.isTraceEnabled();
        return new ExtractFromRow() {
            @Override
            public Object getValueInRow( RowAccessor row ) {
                CachedNode node = row.getNode(indexInRow);
                if (node == null) return null;
                List<Object> values = null;
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.RowExtractors.ExtractFromRow

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.