Return-Path: X-Original-To: apmail-zest-commits-archive@minotaur.apache.org Delivered-To: apmail-zest-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D9B1F10976 for ; Wed, 26 Aug 2015 15:45:05 +0000 (UTC) Received: (qmail 81146 invoked by uid 500); 26 Aug 2015 15:45:05 -0000 Delivered-To: apmail-zest-commits-archive@zest.apache.org Received: (qmail 81100 invoked by uid 500); 26 Aug 2015 15:45:05 -0000 Mailing-List: contact commits-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list commits@zest.apache.org Received: (qmail 80782 invoked by uid 99); 26 Aug 2015 15:45:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2015 15:45:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D938EE714D; Wed, 26 Aug 2015 15:45:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: niclas@apache.org To: commits@zest.apache.org Date: Wed, 26 Aug 2015 15:45:11 -0000 Message-Id: In-Reply-To: <3b0cd4249ec842c6afdc1e132d3732fa@git.apache.org> References: <3b0cd4249ec842c6afdc1e132d3732fa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/24] zest-java git commit: ZEST-113; Removed the use of Specification and replaced with Java 8 Predicate. http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java index 0f934aa..bdf002c 100644 --- a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java +++ b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleInstance.java @@ -27,6 +27,7 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiFunction; import java.util.function.Function; +import java.util.function.Predicate; import org.apache.zest.api.activation.Activation; import org.apache.zest.api.activation.ActivationEventListener; import org.apache.zest.api.activation.ActivationException; @@ -66,7 +67,6 @@ import org.apache.zest.api.value.ValueComposite; import org.apache.zest.api.value.ValueDescriptor; import org.apache.zest.api.value.ValueSerialization; import org.apache.zest.api.value.ValueSerializationException; -import org.apache.zest.functional.Specification; import org.apache.zest.functional.Specifications; import org.apache.zest.runtime.activation.ActivationDelegate; import org.apache.zest.runtime.composite.FunctionStateResolver; @@ -684,25 +684,25 @@ public class ModuleInstance public Iterable> visibleObjects( Visibility visibility ) { return map( ModelModule.modelModuleFunction( this ), - filter( new VisibilitySpecification( visibility ), objects.models() ) ); + filter( new Visibilitypredicate( visibility ), objects.models() ) ); } public Iterable> visibleTransients( Visibility visibility ) { return map( ModelModule.modelModuleFunction( this ), - filter( new VisibilitySpecification( visibility ), transients.models() ) ); + filter( new Visibilitypredicate( visibility ), transients.models() ) ); } public Iterable> visibleEntities( Visibility visibility ) { return map( ModelModule.modelModuleFunction( this ), - filter( new VisibilitySpecification( visibility ), entities.models() ) ); + filter( new Visibilitypredicate( visibility ), entities.models() ) ); } public Iterable> visibleValues( Visibility visibility ) { return map( ModelModule.modelModuleFunction( this ), - filter( new VisibilitySpecification( visibility ), values.models() ) ); + filter( new Visibilitypredicate( visibility ), values.models() ) ); } public Iterable> visibleServices( Visibility visibility ) @@ -732,8 +732,8 @@ public class ModuleInstance Class clazz = classes.get( name ); if( clazz == null ) { - Specification modelTypeSpecification = modelTypeSpecification( name ); - Specification> translate = Specifications.translate( ModelModule.modelFunction(), modelTypeSpecification ); + Predicate modelTypeSpecification = modelTypeSpecification( name ); + Predicate> translate = Specifications.translate( ModelModule.modelFunction(), modelTypeSpecification ); // Check module { Iterable> i = cast( flatten( http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleUnitOfWork.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleUnitOfWork.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleUnitOfWork.java index c61adcd..af796fa 100644 --- a/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleUnitOfWork.java +++ b/core/runtime/src/main/java/org/apache/zest/runtime/structure/ModuleUnitOfWork.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.function.Function; +import java.util.function.Predicate; import org.apache.zest.api.association.AssociationDescriptor; import org.apache.zest.api.association.AssociationStateHolder; import org.apache.zest.api.common.QualifiedName; @@ -50,7 +51,6 @@ import org.apache.zest.api.util.NullArgumentException; import org.apache.zest.api.value.ValueBuilder; import org.apache.zest.api.value.ValueComposite; import org.apache.zest.functional.Iterables; -import org.apache.zest.functional.Specification; import org.apache.zest.runtime.association.AssociationInstance; import org.apache.zest.runtime.association.ManyAssociationInstance; import org.apache.zest.runtime.association.NamedAssociationInstance; @@ -488,7 +488,7 @@ public class ModuleUnitOfWork @Override public T find( Class resultType, - Specification whereClause, + Predicate whereClause, Iterable orderBySegments, Integer firstResult, Integer maxResults, @@ -523,7 +523,7 @@ public class ModuleUnitOfWork @Override public long count( Class resultType, - Specification whereClause, + Predicate whereClause, Iterable orderBySegments, Integer firstResult, Integer maxResults, @@ -545,7 +545,7 @@ public class ModuleUnitOfWork @Override public Iterator iterator( final Class resultType, - Specification whereClause, + Predicate whereClause, Iterable orderBySegments, Integer firstResult, Integer maxResults, http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookup.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookup.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookup.java index fcae944..db52048 100644 --- a/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookup.java +++ b/core/runtime/src/main/java/org/apache/zest/runtime/structure/TypeLookup.java @@ -28,11 +28,11 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.function.Predicate; import org.apache.zest.api.composite.AmbiguousTypeException; import org.apache.zest.api.composite.ModelDescriptor; import org.apache.zest.api.service.NoSuchServiceException; import org.apache.zest.api.service.ServiceReference; -import org.apache.zest.functional.Specification; import org.apache.zest.functional.Specifications; import org.apache.zest.runtime.composite.TransientModel; import org.apache.zest.runtime.entity.EntityModel; @@ -441,21 +441,21 @@ public class TypeLookup } @SuppressWarnings( { "raw", "unchecked" } ) - private static Iterable> findModels( Specification>> specification, + private static Iterable> findModels( Predicate>> specification, Iterable>... models ) { - Specification> spec = Specifications.translate( new ModelModuleTypesFunction(), specification ); + Predicate> spec = Specifications.translate( new ModelModuleTypesFunction(), specification ); Iterable> flattened = flattenIterables( iterable( models ) ); return filter( spec, flattened ); } @SuppressWarnings( { "raw", "unchecked" } ) - private static Iterable> findServiceReferences( Specification>> specification, + private static Iterable> findServiceReferences( Predicate>> specification, Iterable>... references ) { - Specification> spec = Specifications.translate( new ServiceReferenceTypesFunction(), specification ); + Predicate> spec = Specifications.translate( new ServiceReferenceTypesFunction(), specification ); Iterable> flattened = flattenIterables( iterable( references ) ); return filter( spec, flattened ); } @@ -532,7 +532,7 @@ public class TypeLookup } private static abstract class AbstractTypeLookupSpecification - implements Specification>> + implements Predicate>> { protected final Type lookedUpType; @@ -543,7 +543,7 @@ public class TypeLookup } @Override - public final boolean satisfiedBy( Iterable> types ) + public final boolean test( Iterable> types ) { if( lookedUpType instanceof Class ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/main/java/org/apache/zest/runtime/structure/VisibilitySpecification.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/VisibilitySpecification.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/VisibilitySpecification.java deleted file mode 100644 index bb646eb..0000000 --- a/core/runtime/src/main/java/org/apache/zest/runtime/structure/VisibilitySpecification.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.zest.runtime.structure; - -import org.apache.zest.api.common.Visibility; -import org.apache.zest.api.composite.ModelDescriptor; -import org.apache.zest.functional.Specification; - -/** - * TODO - */ -public class VisibilitySpecification - implements Specification -{ - public static final Specification MODULE = new VisibilitySpecification( Visibility.module ); - public static final Specification LAYER = new VisibilitySpecification( Visibility.layer ); - public static final Specification APPLICATION = new VisibilitySpecification( Visibility.application ); - - private final Visibility visibility; - - public VisibilitySpecification( Visibility visibility ) - { - this.visibility = visibility; - } - - @Override - public boolean satisfiedBy( ModelDescriptor item ) - { - return item.visibility().ordinal() >= visibility.ordinal(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/main/java/org/apache/zest/runtime/structure/Visibilitypredicate.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/structure/Visibilitypredicate.java b/core/runtime/src/main/java/org/apache/zest/runtime/structure/Visibilitypredicate.java new file mode 100644 index 0000000..175ecf7 --- /dev/null +++ b/core/runtime/src/main/java/org/apache/zest/runtime/structure/Visibilitypredicate.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.zest.runtime.structure; + +import java.util.function.Predicate; +import org.apache.zest.api.common.Visibility; +import org.apache.zest.api.composite.ModelDescriptor; + +/** + * TODO + */ +public class Visibilitypredicate + implements Predicate +{ + public static final Predicate MODULE = new Visibilitypredicate( Visibility.module ); + public static final Predicate LAYER = new Visibilitypredicate( Visibility.layer ); + public static final Predicate APPLICATION = new Visibilitypredicate( Visibility.application ); + + private final Visibility visibility; + + public Visibilitypredicate( Visibility visibility ) + { + this.visibility = visibility; + } + + @Override + public boolean test( ModelDescriptor item ) + { + return item.visibility().ordinal() >= visibility.ordinal(); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/main/java/org/apache/zest/runtime/types/ValueTypeFactory.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/types/ValueTypeFactory.java b/core/runtime/src/main/java/org/apache/zest/runtime/types/ValueTypeFactory.java index e3195ba..4626105 100644 --- a/core/runtime/src/main/java/org/apache/zest/runtime/types/ValueTypeFactory.java +++ b/core/runtime/src/main/java/org/apache/zest/runtime/types/ValueTypeFactory.java @@ -210,7 +210,7 @@ public class ValueTypeFactory else if( visited instanceof ValueModel ) { ValueModel valueModel = (ValueModel) visited; - boolean typeEquality = Specifications.in( valueModel.types() ).satisfiedBy( type ); + boolean typeEquality = Specifications.in( valueModel.types() ).test( type ); if( typeEquality && valueModel.visibility().ordinal() >= visibility.ordinal() ) { foundModel = valueModel; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java index a390874..a112f51 100644 --- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java +++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/BuilderEntityState.java @@ -81,7 +81,7 @@ public final class BuilderEntityState @Override public boolean isAssignableTo( Class type ) { - return Classes.exactTypeSpecification( type ).satisfiedBy( entityType ); + return Classes.exactTypeSpecification( type ).test( entityType ); } @Override http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/test/java/org/apache/zest/runtime/injection/ServiceInjectionTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/injection/ServiceInjectionTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/injection/ServiceInjectionTest.java index 4f44a68..fbf691e 100644 --- a/core/runtime/src/test/java/org/apache/zest/runtime/injection/ServiceInjectionTest.java +++ b/core/runtime/src/test/java/org/apache/zest/runtime/injection/ServiceInjectionTest.java @@ -17,6 +17,7 @@ package org.apache.zest.runtime.injection; import java.io.Serializable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.function.Predicate; import org.junit.Test; import org.apache.zest.api.activation.ActivationException; import org.apache.zest.api.common.ConstructionException; @@ -36,7 +37,6 @@ import org.apache.zest.bootstrap.LayerAssembly; import org.apache.zest.bootstrap.ModuleAssembly; import org.apache.zest.bootstrap.ServiceDeclaration; import org.apache.zest.bootstrap.SingletonAssembler; -import org.apache.zest.functional.Specification; import static org.junit.Assert.assertEquals; import static org.apache.zest.api.common.Visibility.application; @@ -294,11 +294,11 @@ public class ServiceInjectionTest public static final class NamedSelector implements AnnotationQualifier { - public Specification> qualifier( final Named named ) + public Predicate> qualifier( final Named named ) { - return new Specification>() + return new Predicate>() { - public boolean satisfiedBy( ServiceReference service ) + public boolean test( ServiceReference service ) { ServiceName serviceName = service.metaInfo( ServiceName.class ); return ( serviceName != null && serviceName.getName().equals( named.value() ) ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/runtime/src/test/java/org/apache/zest/runtime/mixin/JDKMixinTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/mixin/JDKMixinTest.java b/core/runtime/src/test/java/org/apache/zest/runtime/mixin/JDKMixinTest.java index ef7aae2..66888eb 100644 --- a/core/runtime/src/test/java/org/apache/zest/runtime/mixin/JDKMixinTest.java +++ b/core/runtime/src/test/java/org/apache/zest/runtime/mixin/JDKMixinTest.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; @@ -30,7 +31,6 @@ import org.apache.zest.api.injection.scope.This; import org.apache.zest.api.service.ServiceReference; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.functional.Specification; import org.apache.zest.test.AbstractZestTest; import static org.hamcrest.core.IsEqual.*; @@ -103,8 +103,8 @@ public class JDKMixinTest private static final String EXTENDS_IDENTITY = ExtendsJDKMixin.class.getName(); private static final String COMPOSE_IDENTITY = ComposeWithJDKMixin.class.getName(); - private static final Specification> EXTENDS_IDENTITY_SPEC = new ServiceIdentitySpec( EXTENDS_IDENTITY ); - private static final Specification> COMPOSE_IDENTITY_SPEC = new ServiceIdentitySpec( COMPOSE_IDENTITY ); + private static final Predicate> EXTENDS_IDENTITY_SPEC = new ServiceIdentitySpec( EXTENDS_IDENTITY ); + private static final Predicate> COMPOSE_IDENTITY_SPEC = new ServiceIdentitySpec( COMPOSE_IDENTITY ); private static final List CONCERN_RECORDS = new ArrayList(); @Before @@ -170,7 +170,7 @@ public class JDKMixinTest } private static class ServiceIdentitySpec - implements Specification> + implements Predicate> { private final String identity; @@ -181,7 +181,7 @@ public class JDKMixinTest } @Override - public boolean satisfiedBy( ServiceReference item ) + public boolean test( ServiceReference item ) { return item.identity().equals( identity ); } http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java index 6594364..459fba0 100644 --- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java +++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/DefaultEntityState.java @@ -208,7 +208,7 @@ public final class DefaultEntityState @Override public boolean isAssignableTo( Class type ) { - return Classes.exactTypeSpecification( type ).satisfiedBy( entityDescriptor ); + return Classes.exactTypeSpecification( type ).test( entityDescriptor ); } @Override http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/spi/src/main/java/org/apache/zest/spi/query/EntityFinder.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/zest/spi/query/EntityFinder.java b/core/spi/src/main/java/org/apache/zest/spi/query/EntityFinder.java index 3b62743..1663895 100644 --- a/core/spi/src/main/java/org/apache/zest/spi/query/EntityFinder.java +++ b/core/spi/src/main/java/org/apache/zest/spi/query/EntityFinder.java @@ -19,11 +19,11 @@ package org.apache.zest.spi.query; import java.util.Map; +import java.util.function.Predicate; import org.apache.zest.api.common.Optional; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.entity.EntityReference; import org.apache.zest.api.query.grammar.OrderBy; -import org.apache.zest.functional.Specification; /** * Entity Finder. @@ -42,7 +42,7 @@ public interface EntityFinder * @return Single entity matching the query criterion. */ Iterable findEntities( Class resultType, - @Optional Specification whereClause, + @Optional Predicate whereClause, @Optional OrderBy[] orderBySegments, @Optional Integer firstResult, @Optional Integer maxResults, @@ -59,7 +59,7 @@ public interface EntityFinder * @return Single entity matching the query criterion. */ EntityReference findEntity( Class resultType, - @Optional Specification whereClause, + @Optional Predicate whereClause, Map variables ) throws EntityFinderException; @@ -73,7 +73,7 @@ public interface EntityFinder * @return Count entities matching the query criterion. */ long countEntities( Class resultType, - @Optional Specification whereClause, + @Optional Predicate whereClause, Map variables ) throws EntityFinderException; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/spi/src/main/java/org/apache/zest/spi/query/QuerySource.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/zest/spi/query/QuerySource.java b/core/spi/src/main/java/org/apache/zest/spi/query/QuerySource.java index 46ea8a0..1562534 100644 --- a/core/spi/src/main/java/org/apache/zest/spi/query/QuerySource.java +++ b/core/spi/src/main/java/org/apache/zest/spi/query/QuerySource.java @@ -20,9 +20,9 @@ package org.apache.zest.spi.query; import java.util.Iterator; import java.util.Map; +import java.util.function.Predicate; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.query.grammar.OrderBy; -import org.apache.zest.functional.Specification; /** * Query Source, used in QueryBuilder SPI. @@ -30,7 +30,7 @@ import org.apache.zest.functional.Specification; public interface QuerySource { T find( Class resultType, - Specification whereClause, + Predicate whereClause, Iterable orderBySegments, Integer firstResult, Integer maxResults, @@ -38,7 +38,7 @@ public interface QuerySource ); long count( Class resultType, - Specification whereClause, + Predicate whereClause, Iterable orderBySegments, Integer firstResult, Integer maxResults, @@ -46,7 +46,7 @@ public interface QuerySource ); Iterator iterator( Class resultType, - Specification whereClause, + Predicate whereClause, Iterable orderBySegments, Integer firstResult, Integer maxResults, http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractEntityFinderTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractEntityFinderTest.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractEntityFinderTest.java index c5b2a4c..f02c0f9 100644 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractEntityFinderTest.java +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractEntityFinderTest.java @@ -26,13 +26,13 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import org.junit.Before; import org.junit.Test; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.entity.EntityReference; import org.apache.zest.api.query.grammar.OrderBy; import org.apache.zest.api.service.ServiceReference; -import org.apache.zest.functional.Specification; import org.apache.zest.spi.query.EntityFinder; import org.apache.zest.spi.query.EntityFinderException; import org.apache.zest.spi.query.IndexExporter; @@ -65,7 +65,7 @@ public abstract class AbstractEntityFinderTest extends AbstractAnyQueryTest { - private static final Specification ALL = null; + private static final Predicate ALL = null; private static final OrderBy[] NO_SORTING = null; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java index 2d0637b..1f52478 100644 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractNamedQueryTest.java @@ -20,13 +20,13 @@ package org.apache.zest.test.indexing; import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.function.Predicate; import org.junit.Test; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.query.Query; import org.apache.zest.api.query.grammar.OrderBy; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.functional.Specification; import org.apache.zest.spi.query.EntityFinderException; import org.apache.zest.spi.query.IndexExporter; import org.apache.zest.test.EntityTestAssembler; @@ -51,7 +51,7 @@ public abstract class AbstractNamedQueryTest extends AbstractAnyQueryTest { - private final Map> queries = new HashMap<>(); + private final Map> queries = new HashMap<>(); @Override public void assemble( ModuleAssembly module ) @@ -65,7 +65,7 @@ public abstract class AbstractNamedQueryTest String queryName = String.format( "script%02d", i + 1 ); if( query[i].length() != 0 ) { - Specification expression = createNamedQueryDescriptor( queryName, query[i] ); + Predicate expression = createNamedQueryDescriptor( queryName, query[i] ); queries.put( queryName, expression ); } } @@ -73,7 +73,7 @@ public abstract class AbstractNamedQueryTest protected abstract String[] queryStrings(); - protected abstract Specification createNamedQueryDescriptor( String queryName, String queryString ); + protected abstract Predicate createNamedQueryDescriptor( String queryName, String queryString ); @Test public void showNetwork() http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinder.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinder.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinder.java index b1a6883..7c9b979 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinder.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinder.java @@ -20,6 +20,7 @@ package org.apache.zest.index.elasticsearch; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import java.util.function.Predicate; import org.elasticsearch.action.count.CountRequestBuilder; import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.action.search.SearchRequestBuilder; @@ -34,32 +35,31 @@ import org.apache.zest.api.composite.Composite; import org.apache.zest.api.entity.EntityReference; import org.apache.zest.api.injection.scope.This; import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.api.query.grammar.AndSpecification; -import org.apache.zest.api.query.grammar.AssociationNotNullSpecification; -import org.apache.zest.api.query.grammar.AssociationNullSpecification; -import org.apache.zest.api.query.grammar.BinarySpecification; -import org.apache.zest.api.query.grammar.ComparisonSpecification; -import org.apache.zest.api.query.grammar.ContainsAllSpecification; -import org.apache.zest.api.query.grammar.ContainsSpecification; -import org.apache.zest.api.query.grammar.EqSpecification; -import org.apache.zest.api.query.grammar.GeSpecification; -import org.apache.zest.api.query.grammar.GtSpecification; -import org.apache.zest.api.query.grammar.LeSpecification; -import org.apache.zest.api.query.grammar.LtSpecification; -import org.apache.zest.api.query.grammar.ManyAssociationContainsSpecification; -import org.apache.zest.api.query.grammar.MatchesSpecification; -import org.apache.zest.api.query.grammar.NamedAssociationContainsNameSpecification; -import org.apache.zest.api.query.grammar.NamedAssociationContainsSpecification; -import org.apache.zest.api.query.grammar.NeSpecification; -import org.apache.zest.api.query.grammar.NotSpecification; -import org.apache.zest.api.query.grammar.OrSpecification; +import org.apache.zest.api.query.grammar.AndPredicate; +import org.apache.zest.api.query.grammar.AssociationNotNullPredicate; +import org.apache.zest.api.query.grammar.AssociationNullPredicate; +import org.apache.zest.api.query.grammar.BinaryPredicate; +import org.apache.zest.api.query.grammar.ComparisonPredicate; +import org.apache.zest.api.query.grammar.ContainsAllPredicate; +import org.apache.zest.api.query.grammar.ContainsPredicate; +import org.apache.zest.api.query.grammar.EqPredicate; +import org.apache.zest.api.query.grammar.GePredicate; +import org.apache.zest.api.query.grammar.GtPredicate; +import org.apache.zest.api.query.grammar.LePredicate; +import org.apache.zest.api.query.grammar.LtPredicate; +import org.apache.zest.api.query.grammar.ManyAssociationContainsPredicate; +import org.apache.zest.api.query.grammar.MatchesPredicate; +import org.apache.zest.api.query.grammar.NamedAssociationContainsNamePredicate; +import org.apache.zest.api.query.grammar.NamedAssociationContainsPredicate; +import org.apache.zest.api.query.grammar.NePredicate; +import org.apache.zest.api.query.grammar.Notpredicate; +import org.apache.zest.api.query.grammar.OrPredicate; import org.apache.zest.api.query.grammar.OrderBy; -import org.apache.zest.api.query.grammar.PropertyNotNullSpecification; -import org.apache.zest.api.query.grammar.PropertyNullSpecification; +import org.apache.zest.api.query.grammar.PropertyNotNullPredicate; +import org.apache.zest.api.query.grammar.PropertyNullPredicate; import org.apache.zest.api.query.grammar.QuerySpecification; import org.apache.zest.api.value.ValueComposite; import org.apache.zest.functional.Iterables; -import org.apache.zest.functional.Specification; import org.apache.zest.index.elasticsearch.ElasticSearchFinderSupport.ComplexTypeSupport; import org.apache.zest.spi.query.EntityFinder; import org.apache.zest.spi.query.EntityFinderException; @@ -93,7 +93,7 @@ public interface ElasticSearchFinder @Override public Iterable findEntities( Class resultType, - Specification whereClause, + Predicate whereClause, OrderBy[] orderBySegments, Integer firstResult, Integer maxResults, Map variables ) @@ -146,7 +146,7 @@ public interface ElasticSearchFinder @Override public EntityReference findEntity( Class resultType, - Specification whereClause, + Predicate whereClause, Map variables ) throws EntityFinderException { @@ -175,7 +175,7 @@ public interface ElasticSearchFinder @Override public long countEntities( Class resultType, - Specification whereClause, + Predicate whereClause, Map variables ) throws EntityFinderException { @@ -202,7 +202,7 @@ public interface ElasticSearchFinder } private QueryBuilder processWhereSpecification( AndFilterBuilder filterBuilder, - Specification spec, + Predicate spec, Map variables ) throws EntityFinderException { @@ -221,76 +221,76 @@ public interface ElasticSearchFinder } private void processSpecification( FilterBuilder filterBuilder, - Specification spec, + Predicate spec, Map variables ) throws EntityFinderException { - if( spec instanceof BinarySpecification ) + if( spec instanceof BinaryPredicate ) { - BinarySpecification binSpec = (BinarySpecification) spec; + BinaryPredicate binSpec = (BinaryPredicate) spec; processBinarySpecification( filterBuilder, binSpec, variables ); } - else if( spec instanceof NotSpecification ) + else if( spec instanceof Notpredicate ) { - NotSpecification notSpec = (NotSpecification) spec; + Notpredicate notSpec = (Notpredicate) spec; processNotSpecification( filterBuilder, notSpec, variables ); } - else if( spec instanceof ComparisonSpecification ) + else if( spec instanceof ComparisonPredicate ) { - ComparisonSpecification compSpec = (ComparisonSpecification) spec; + ComparisonPredicate compSpec = (ComparisonPredicate) spec; processComparisonSpecification( filterBuilder, compSpec, variables ); } - else if( spec instanceof ContainsAllSpecification ) + else if( spec instanceof ContainsAllPredicate ) { - ContainsAllSpecification contAllSpec = (ContainsAllSpecification) spec; + ContainsAllPredicate contAllSpec = (ContainsAllPredicate) spec; processContainsAllSpecification( filterBuilder, contAllSpec, variables ); } - else if( spec instanceof ContainsSpecification ) + else if( spec instanceof ContainsPredicate ) { - ContainsSpecification contSpec = (ContainsSpecification) spec; + ContainsPredicate contSpec = (ContainsPredicate) spec; processContainsSpecification( filterBuilder, contSpec, variables ); } - else if( spec instanceof MatchesSpecification ) + else if( spec instanceof MatchesPredicate ) { - MatchesSpecification matchSpec = (MatchesSpecification) spec; + MatchesPredicate matchSpec = (MatchesPredicate) spec; processMatchesSpecification( filterBuilder, matchSpec, variables ); } - else if( spec instanceof PropertyNotNullSpecification ) + else if( spec instanceof PropertyNotNullPredicate ) { - PropertyNotNullSpecification propNotNullSpec = (PropertyNotNullSpecification) spec; + PropertyNotNullPredicate propNotNullSpec = (PropertyNotNullPredicate) spec; processPropertyNotNullSpecification( filterBuilder, propNotNullSpec ); } - else if( spec instanceof PropertyNullSpecification ) + else if( spec instanceof PropertyNullPredicate ) { - PropertyNullSpecification propNullSpec = (PropertyNullSpecification) spec; + PropertyNullPredicate propNullSpec = (PropertyNullPredicate) spec; processPropertyNullSpecification( filterBuilder, propNullSpec ); } - else if( spec instanceof AssociationNotNullSpecification ) + else if( spec instanceof AssociationNotNullPredicate ) { - AssociationNotNullSpecification assNotNullSpec = (AssociationNotNullSpecification) spec; + AssociationNotNullPredicate assNotNullSpec = (AssociationNotNullPredicate) spec; processAssociationNotNullSpecification( filterBuilder, assNotNullSpec ); } - else if( spec instanceof AssociationNullSpecification ) + else if( spec instanceof AssociationNullPredicate ) { - AssociationNullSpecification assNullSpec = (AssociationNullSpecification) spec; + AssociationNullPredicate assNullSpec = (AssociationNullPredicate) spec; processAssociationNullSpecification( filterBuilder, assNullSpec ); } - else if( spec instanceof ManyAssociationContainsSpecification ) + else if( spec instanceof ManyAssociationContainsPredicate ) { - ManyAssociationContainsSpecification manyAssContSpec = (ManyAssociationContainsSpecification) spec; + ManyAssociationContainsPredicate manyAssContSpec = (ManyAssociationContainsPredicate) spec; processManyAssociationContainsSpecification( filterBuilder, manyAssContSpec, variables ); } - else if( spec instanceof NamedAssociationContainsSpecification ) + else if( spec instanceof NamedAssociationContainsPredicate ) { - NamedAssociationContainsSpecification namedAssContSpec = (NamedAssociationContainsSpecification) spec; + NamedAssociationContainsPredicate namedAssContSpec = (NamedAssociationContainsPredicate) spec; processNamedAssociationContainsSpecification( filterBuilder, namedAssContSpec, variables ); } - else if( spec instanceof NamedAssociationContainsNameSpecification ) + else if( spec instanceof NamedAssociationContainsNamePredicate ) { - NamedAssociationContainsNameSpecification namedAssContNameSpec = (NamedAssociationContainsNameSpecification) spec; + NamedAssociationContainsNamePredicate namedAssContNameSpec = (NamedAssociationContainsNamePredicate) spec; processNamedAssociationContainsNameSpecification( filterBuilder, namedAssContNameSpec, variables ); } @@ -319,26 +319,26 @@ public interface ElasticSearchFinder } private void processBinarySpecification( FilterBuilder filterBuilder, - BinarySpecification spec, + BinaryPredicate spec, Map variables ) throws EntityFinderException { LOGGER.trace( "Processing BinarySpecification {}", spec ); - Iterable> operands = spec.operands(); + Iterable> operands = spec.operands(); - if( spec instanceof AndSpecification ) + if( spec instanceof AndPredicate ) { AndFilterBuilder andFilterBuilder = new AndFilterBuilder(); - for( Specification operand : operands ) + for( Predicate operand : operands ) { processSpecification( andFilterBuilder, operand, variables ); } addFilter( andFilterBuilder, filterBuilder ); } - else if( spec instanceof OrSpecification ) + else if( spec instanceof OrPredicate ) { OrFilterBuilder orFilterBuilder = new OrFilterBuilder(); - for( Specification operand : operands ) + for( Predicate operand : operands ) { processSpecification( orFilterBuilder, operand, variables ); } @@ -352,7 +352,7 @@ public interface ElasticSearchFinder } private void processNotSpecification( FilterBuilder filterBuilder, - NotSpecification spec, + Notpredicate spec, Map variables ) throws EntityFinderException { @@ -363,7 +363,7 @@ public interface ElasticSearchFinder } private void processComparisonSpecification( FilterBuilder filterBuilder, - ComparisonSpecification spec, + ComparisonPredicate spec, Map variables ) { LOGGER.trace( "Processing ComparisonSpecification {}", spec ); @@ -385,29 +385,29 @@ public interface ElasticSearchFinder // Query by simple property value String name = spec.property().toString(); Object value = resolveVariable( spec.value(), variables ); - if( spec instanceof EqSpecification ) + if( spec instanceof EqPredicate ) { addFilter( termFilter( name, value ), filterBuilder ); } - else if( spec instanceof NeSpecification ) + else if( spec instanceof NePredicate ) { addFilter( andFilter( existsFilter( name ), notFilter( termFilter( name, value ) ) ), filterBuilder ); } - else if( spec instanceof GeSpecification ) + else if( spec instanceof GePredicate ) { addFilter( rangeFilter( name ).gte( value ), filterBuilder ); } - else if( spec instanceof GtSpecification ) + else if( spec instanceof GtPredicate ) { addFilter( rangeFilter( name ).gt( value ), filterBuilder ); } - else if( spec instanceof LeSpecification ) + else if( spec instanceof LePredicate ) { addFilter( rangeFilter( name ).lte( value ), filterBuilder ); } - else if( spec instanceof LtSpecification ) + else if( spec instanceof LtPredicate ) { addFilter( rangeFilter( name ).lt( value ), filterBuilder ); } @@ -421,7 +421,7 @@ public interface ElasticSearchFinder } private void processContainsAllSpecification( FilterBuilder filterBuilder, - ContainsAllSpecification spec, + ContainsAllPredicate spec, Map variables ) { LOGGER.trace( "Processing ContainsAllSpecification {}", spec ); @@ -450,7 +450,7 @@ public interface ElasticSearchFinder } private void processContainsSpecification( FilterBuilder filterBuilder, - ContainsSpecification spec, + ContainsPredicate spec, Map variables ) { LOGGER.trace( "Processing ContainsSpecification {}", spec ); @@ -474,7 +474,7 @@ public interface ElasticSearchFinder } private void processMatchesSpecification( FilterBuilder filterBuilder, - MatchesSpecification spec, + MatchesPredicate spec, Map variables ) { LOGGER.trace( "Processing MatchesSpecification {}", spec ); @@ -484,35 +484,35 @@ public interface ElasticSearchFinder } private void processPropertyNotNullSpecification( FilterBuilder filterBuilder, - PropertyNotNullSpecification spec ) + PropertyNotNullPredicate spec ) { LOGGER.trace( "Processing PropertyNotNullSpecification {}", spec ); addFilter( existsFilter( spec.property().toString() ), filterBuilder ); } private void processPropertyNullSpecification( FilterBuilder filterBuilder, - PropertyNullSpecification spec ) + PropertyNullPredicate spec ) { LOGGER.trace( "Processing PropertyNullSpecification {}", spec ); addFilter( missingFilter( spec.property().toString() ), filterBuilder ); } private void processAssociationNotNullSpecification( FilterBuilder filterBuilder, - AssociationNotNullSpecification spec ) + AssociationNotNullPredicate spec ) { LOGGER.trace( "Processing AssociationNotNullSpecification {}", spec ); addFilter( existsFilter( spec.association().toString() + ".identity" ), filterBuilder ); } private void processAssociationNullSpecification( FilterBuilder filterBuilder, - AssociationNullSpecification spec ) + AssociationNullPredicate spec ) { LOGGER.trace( "Processing AssociationNullSpecification {}", spec ); addFilter( missingFilter( spec.association().toString() + ".identity" ), filterBuilder ); } private void processManyAssociationContainsSpecification( FilterBuilder filterBuilder, - ManyAssociationContainsSpecification spec, + ManyAssociationContainsPredicate spec, Map variables ) { LOGGER.trace( "Processing ManyAssociationContainsSpecification {}", spec ); @@ -522,7 +522,7 @@ public interface ElasticSearchFinder } private void processNamedAssociationContainsSpecification( FilterBuilder filterBuilder, - NamedAssociationContainsSpecification spec, + NamedAssociationContainsPredicate spec, Map variables ) { LOGGER.trace( "Processing NamedAssociationContainsSpecification {}", spec ); @@ -532,7 +532,7 @@ public interface ElasticSearchFinder } private void processNamedAssociationContainsNameSpecification( FilterBuilder filterBuilder, - NamedAssociationContainsNameSpecification spec, + NamedAssociationContainsNamePredicate spec, Map variables ) { LOGGER.trace( "Processing NamedAssociationContainsNameSpecification {}", spec ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinderSupport.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinderSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinderSupport.java index 1682b49..629c09c 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinderSupport.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchFinderSupport.java @@ -19,9 +19,9 @@ package org.apache.zest.index.elasticsearch; import java.util.Map; import org.elasticsearch.index.query.FilterBuilder; -import org.apache.zest.api.query.grammar.ComparisonSpecification; -import org.apache.zest.api.query.grammar.ContainsAllSpecification; -import org.apache.zest.api.query.grammar.ContainsSpecification; +import org.apache.zest.api.query.grammar.ComparisonPredicate; +import org.apache.zest.api.query.grammar.ContainsAllPredicate; +import org.apache.zest.api.query.grammar.ContainsPredicate; import org.apache.zest.api.query.grammar.Variable; @@ -50,11 +50,11 @@ import org.apache.zest.api.query.grammar.Variable; /* package */ static interface ComplexTypeSupport { - FilterBuilder comparison( ComparisonSpecification spec, Map variables ); + FilterBuilder comparison( ComparisonPredicate spec, Map variables ); - FilterBuilder contains( ContainsSpecification spec, Map variables ); + FilterBuilder contains( ContainsPredicate spec, Map variables ); - FilterBuilder containsAll( ContainsAllSpecification spec, Map variables ); + FilterBuilder containsAll( ContainsAllPredicate spec, Map variables ); } http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryParser.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryParser.java b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryParser.java index 0082c13..e4afc8c 100644 --- a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryParser.java +++ b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryParser.java @@ -19,14 +19,14 @@ package org.apache.zest.index.rdf.query; import java.util.Map; +import java.util.function.Predicate; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.query.grammar.OrderBy; -import org.apache.zest.functional.Specification; public interface RdfQueryParser { String constructQuery( Class resultType, - Specification whereClause, + Predicate whereClause, OrderBy[] orderBySegments, Integer firstResult, Integer maxResults, http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryService.java b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryService.java index 1e1f4aa..4b62213 100644 --- a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryService.java +++ b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/RdfQueryService.java @@ -18,6 +18,7 @@ package org.apache.zest.index.rdf.query; import java.util.Map; +import java.util.function.Predicate; import org.openrdf.query.QueryLanguage; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.entity.EntityReference; @@ -27,7 +28,6 @@ import org.apache.zest.api.mixin.Mixins; import org.apache.zest.api.query.grammar.OrderBy; import org.apache.zest.api.query.grammar.QuerySpecification; import org.apache.zest.api.service.ServiceComposite; -import org.apache.zest.functional.Specification; import org.apache.zest.spi.query.EntityFinder; import org.apache.zest.spi.query.EntityFinderException; @@ -55,7 +55,7 @@ public interface RdfQueryService @Override public Iterable findEntities( Class resultType, - Specification whereClause, + Predicate whereClause, OrderBy[] orderBySegments, Integer firstResult, Integer maxResults, @@ -82,7 +82,7 @@ public interface RdfQueryService } @Override - public EntityReference findEntity( Class resultType, Specification whereClause, Map variables ) + public EntityReference findEntity( Class resultType, Predicate whereClause, Map variables ) throws EntityFinderException { final SingleQualifiedIdentityResultCallback singleCallback = new SingleQualifiedIdentityResultCallback(); @@ -102,7 +102,7 @@ public interface RdfQueryService } @Override - public long countEntities( Class resultType, Specification whereClause, Map variables ) + public long countEntities( Class resultType, Predicate whereClause, Map variables ) throws EntityFinderException { if (QuerySpecification.isQueryLanguage( "SERQL", whereClause )) http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java index 2a4202f..f65d76b 100644 --- a/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java +++ b/extensions/indexing-rdf/src/main/java/org/apache/zest/index/rdf/query/internal/RdfQueryParserImpl.java @@ -27,35 +27,35 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.TimeZone; +import java.util.function.Predicate; import org.apache.commons.lang.StringEscapeUtils; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.query.grammar.AndSpecification; -import org.apache.zest.api.query.grammar.AssociationNotNullSpecification; -import org.apache.zest.api.query.grammar.AssociationNullSpecification; -import org.apache.zest.api.query.grammar.ComparisonSpecification; -import org.apache.zest.api.query.grammar.ContainsAllSpecification; -import org.apache.zest.api.query.grammar.ContainsSpecification; -import org.apache.zest.api.query.grammar.EqSpecification; -import org.apache.zest.api.query.grammar.GeSpecification; -import org.apache.zest.api.query.grammar.GtSpecification; -import org.apache.zest.api.query.grammar.LeSpecification; -import org.apache.zest.api.query.grammar.LtSpecification; -import org.apache.zest.api.query.grammar.ManyAssociationContainsSpecification; -import org.apache.zest.api.query.grammar.MatchesSpecification; -import org.apache.zest.api.query.grammar.NeSpecification; -import org.apache.zest.api.query.grammar.NotSpecification; -import org.apache.zest.api.query.grammar.OrSpecification; +import org.apache.zest.api.query.grammar.AndPredicate; +import org.apache.zest.api.query.grammar.AssociationNotNullPredicate; +import org.apache.zest.api.query.grammar.AssociationNullPredicate; +import org.apache.zest.api.query.grammar.ComparisonPredicate; +import org.apache.zest.api.query.grammar.ContainsAllPredicate; +import org.apache.zest.api.query.grammar.ContainsPredicate; +import org.apache.zest.api.query.grammar.EqPredicate; +import org.apache.zest.api.query.grammar.GePredicate; +import org.apache.zest.api.query.grammar.GtPredicate; +import org.apache.zest.api.query.grammar.LePredicate; +import org.apache.zest.api.query.grammar.LtPredicate; +import org.apache.zest.api.query.grammar.ManyAssociationContainsPredicate; +import org.apache.zest.api.query.grammar.MatchesPredicate; +import org.apache.zest.api.query.grammar.NePredicate; +import org.apache.zest.api.query.grammar.Notpredicate; +import org.apache.zest.api.query.grammar.OrPredicate; import org.apache.zest.api.query.grammar.OrderBy; import org.apache.zest.api.query.grammar.PropertyFunction; -import org.apache.zest.api.query.grammar.PropertyNotNullSpecification; -import org.apache.zest.api.query.grammar.PropertyNullSpecification; +import org.apache.zest.api.query.grammar.PropertyNotNullPredicate; +import org.apache.zest.api.query.grammar.PropertyNullPredicate; import org.apache.zest.api.query.grammar.QuerySpecification; import org.apache.zest.api.query.grammar.Variable; import org.apache.zest.api.value.ValueSerializer; import org.apache.zest.api.value.ValueSerializer.Options; import org.apache.zest.functional.Iterables; -import org.apache.zest.functional.Specification; import org.apache.zest.index.rdf.query.RdfQueryParser; import org.apache.zest.spi.ZestSPI; import org.slf4j.LoggerFactory; @@ -79,7 +79,7 @@ public class RdfQueryParserImpl } }; - private static final Map, String> OPERATORS; + private static final Map, String> OPERATORS; private static final Set RESERVED_CHARS; private final Namespaces namespaces = new Namespaces(); @@ -91,12 +91,12 @@ public class RdfQueryParserImpl static { OPERATORS = new HashMap<>( 6 ); - OPERATORS.put( EqSpecification.class, "=" ); - OPERATORS.put( GeSpecification.class, ">=" ); - OPERATORS.put( GtSpecification.class, ">" ); - OPERATORS.put( LeSpecification.class, "<=" ); - OPERATORS.put( LtSpecification.class, "<" ); - OPERATORS.put( NeSpecification.class, "!=" ); + OPERATORS.put( EqPredicate.class, "=" ); + OPERATORS.put( GePredicate.class, ">=" ); + OPERATORS.put( GtPredicate.class, ">" ); + OPERATORS.put( LePredicate.class, "<=" ); + OPERATORS.put( LtPredicate.class, "<" ); + OPERATORS.put( NePredicate.class, "!=" ); RESERVED_CHARS = new HashSet<>( Arrays.asList( '\"', '^', '.', '\\', '?', '*', '+', '{', '}', '(', ')', '|', '$', '[', ']' @@ -111,7 +111,7 @@ public class RdfQueryParserImpl @Override public String constructQuery( final Class resultType, - final Specification specification, + final Predicate specification, final OrderBy[] orderBySegments, final Integer firstResult, final Integer maxResults, @@ -214,20 +214,20 @@ public class RdfQueryParserImpl return query.toString(); } - private void processFilter( final Specification expression, boolean allowInline, StringBuilder builder ) + private void processFilter( final Predicate expression, boolean allowInline, StringBuilder builder ) { if( expression == null ) { return; } - if( expression instanceof AndSpecification ) + if( expression instanceof AndPredicate ) { - final AndSpecification conjunction = (AndSpecification) expression; + final AndPredicate conjunction = (AndPredicate) expression; int start = builder.length(); boolean first = true; - for( Specification operand : conjunction.operands() ) + for( Predicate operand : conjunction.operands() ) { int size = builder.length(); processFilter( operand, allowInline, builder ); @@ -250,13 +250,13 @@ public class RdfQueryParserImpl builder.append( ')' ); } } - else if( expression instanceof OrSpecification ) + else if( expression instanceof OrPredicate ) { - final OrSpecification disjunction = (OrSpecification) expression; + final OrPredicate disjunction = (OrPredicate) expression; int start = builder.length(); boolean first = true; - for( Specification operand : disjunction.operands() ) + for( Predicate operand : disjunction.operands() ) { int size = builder.length(); processFilter( operand, false, builder ); @@ -279,47 +279,47 @@ public class RdfQueryParserImpl builder.append( ')' ); } } - else if( expression instanceof NotSpecification ) + else if( expression instanceof Notpredicate ) { builder.insert( 0, "(!" ); - processFilter( ( (NotSpecification) expression ).operand(), false, builder ); + processFilter( ( (Notpredicate) expression ).operand(), false, builder ); builder.append( ")" ); } - else if( expression instanceof ComparisonSpecification ) + else if( expression instanceof ComparisonPredicate ) { processComparisonPredicate( expression, allowInline, builder ); } - else if( expression instanceof ContainsAllSpecification ) + else if( expression instanceof ContainsAllPredicate ) { - processContainsAllPredicate( (ContainsAllSpecification) expression, builder ); + processContainsAllPredicate( (ContainsAllPredicate) expression, builder ); } - else if( expression instanceof ContainsSpecification ) + else if( expression instanceof ContainsPredicate ) { - processContainsPredicate( (ContainsSpecification) expression, builder ); + processContainsPredicate( (ContainsPredicate) expression, builder ); } - else if( expression instanceof MatchesSpecification ) + else if( expression instanceof MatchesPredicate ) { - processMatchesPredicate( (MatchesSpecification) expression, builder ); + processMatchesPredicate( (MatchesPredicate) expression, builder ); } - else if( expression instanceof PropertyNotNullSpecification ) + else if( expression instanceof PropertyNotNullPredicate ) { - processNotNullPredicate( (PropertyNotNullSpecification) expression, builder ); + processNotNullPredicate( (PropertyNotNullPredicate) expression, builder ); } - else if( expression instanceof PropertyNullSpecification ) + else if( expression instanceof PropertyNullPredicate ) { - processNullPredicate( (PropertyNullSpecification) expression, builder ); + processNullPredicate( (PropertyNullPredicate) expression, builder ); } - else if( expression instanceof AssociationNotNullSpecification ) + else if( expression instanceof AssociationNotNullPredicate ) { - processNotNullPredicate( (AssociationNotNullSpecification) expression, builder ); + processNotNullPredicate( (AssociationNotNullPredicate) expression, builder ); } - else if( expression instanceof AssociationNullSpecification ) + else if( expression instanceof AssociationNullPredicate ) { - processNullPredicate( (AssociationNullSpecification) expression, builder ); + processNullPredicate( (AssociationNullPredicate) expression, builder ); } - else if( expression instanceof ManyAssociationContainsSpecification ) + else if( expression instanceof ManyAssociationContainsPredicate ) { - processManyAssociationContainsPredicate( (ManyAssociationContainsSpecification) expression, allowInline, builder ); + processManyAssociationContainsPredicate( (ManyAssociationContainsPredicate) expression, allowInline, builder ); } else { @@ -378,7 +378,7 @@ public class RdfQueryParserImpl return builder.toString(); } - private void processContainsAllPredicate( final ContainsAllSpecification predicate, StringBuilder builder ) + private void processContainsAllPredicate( final ContainsAllPredicate predicate, StringBuilder builder ) { Iterable values = predicate.containedValues(); String valueVariable = triples.addTriple( predicate.collectionProperty(), false ).value(); @@ -421,7 +421,7 @@ public class RdfQueryParserImpl } } - private void processContainsPredicate( final ContainsSpecification predicate, StringBuilder builder ) + private void processContainsPredicate( final ContainsPredicate predicate, StringBuilder builder ) { Object value = predicate.value(); String valueVariable = triples.addTriple( predicate.collectionProperty(), false ).value(); @@ -431,26 +431,26 @@ public class RdfQueryParserImpl ) ); } - private void processMatchesPredicate( final MatchesSpecification predicate, StringBuilder builder ) + private void processMatchesPredicate( final MatchesPredicate predicate, StringBuilder builder ) { String valueVariable = triples.addTriple( predicate.property(), false ).value(); builder.append( format( "regex(%s,\"%s\")", valueVariable, predicate.regexp() ) ); } - private void processComparisonPredicate( final Specification predicate, + private void processComparisonPredicate( final Predicate predicate, boolean allowInline, StringBuilder builder ) { - if( predicate instanceof ComparisonSpecification ) + if( predicate instanceof ComparisonPredicate ) { - ComparisonSpecification comparisonSpecification = (ComparisonSpecification) predicate; - Triples.Triple triple = triples.addTriple( (PropertyFunction) comparisonSpecification.property(), false ); + ComparisonPredicate comparisonPredicate = (ComparisonPredicate) predicate; + Triples.Triple triple = triples.addTriple( (PropertyFunction) comparisonPredicate.property(), false ); // Don't use FILTER for equals-comparison. Do direct match instead - if( predicate instanceof EqSpecification && allowInline ) + if( predicate instanceof EqPredicate && allowInline ) { - triple.setValue( "\"" + toString( comparisonSpecification.value() ) + "\"" ); + triple.setValue( "\"" + toString( comparisonPredicate.value() ) + "\"" ); } else { @@ -458,8 +458,8 @@ public class RdfQueryParserImpl builder.append( String.format( "(%s %s \"%s\")", valueVariable, - getOperator( comparisonSpecification.getClass() ), - toString( comparisonSpecification.value() ) ) ); + getOperator( comparisonPredicate.getClass() ), + toString( comparisonPredicate.value() ) ) ); } } else @@ -469,31 +469,31 @@ public class RdfQueryParserImpl } } - private void processNullPredicate( final PropertyNullSpecification predicate, StringBuilder builder ) + private void processNullPredicate( final PropertyNullPredicate predicate, StringBuilder builder ) { final String value = triples.addTriple( predicate.property(), true ).value(); builder.append( format( "(! bound(%s))", value ) ); } - private void processNotNullPredicate( final PropertyNotNullSpecification predicate, StringBuilder builder ) + private void processNotNullPredicate( final PropertyNotNullPredicate predicate, StringBuilder builder ) { final String value = triples.addTriple( predicate.property(), true ).value(); builder.append( format( "(bound(%s))", value ) ); } - private void processNullPredicate( final AssociationNullSpecification predicate, StringBuilder builder ) + private void processNullPredicate( final AssociationNullPredicate predicate, StringBuilder builder ) { final String value = triples.addTripleAssociation( predicate.association(), true ).value(); builder.append( format( "(! bound(%s))", value ) ); } - private void processNotNullPredicate( final AssociationNotNullSpecification predicate, StringBuilder builder ) + private void processNotNullPredicate( final AssociationNotNullPredicate predicate, StringBuilder builder ) { final String value = triples.addTripleAssociation( predicate.association(), true ).value(); builder.append( format( "(bound(%s))", value ) ); } - private void processManyAssociationContainsPredicate( ManyAssociationContainsSpecification predicate, + private void processManyAssociationContainsPredicate( ManyAssociationContainsPredicate predicate, boolean allowInline, StringBuilder builder ) { @@ -537,7 +537,7 @@ public class RdfQueryParserImpl } } - private String getOperator( final Class predicateClass ) + private String getOperator( final Class predicateClass ) { String operator = OPERATORS.get( predicateClass ); if( operator == null ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java index 1e30994..526f8b2 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java @@ -17,11 +17,11 @@ */ package org.apache.zest.index.rdf; +import java.util.function.Predicate; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.value.ValueSerialization; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.functional.Specification; import org.apache.zest.index.rdf.query.RdfQueryParserFactory; import org.apache.zest.index.rdf.query.SesameExpressions; import org.apache.zest.library.rdf.entity.EntityStateSerializer; @@ -39,7 +39,7 @@ public class RdfNamedQueryTest extends AbstractNamedQueryTest } @Override - protected Specification createNamedQueryDescriptor( String queryName, String queryString ) + protected Predicate createNamedQueryDescriptor( String queryName, String queryString ) { return SesameExpressions.sparql( queryString ); } http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityQueryMixin.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityQueryMixin.java b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityQueryMixin.java index 1631a10..9d0355d 100644 --- a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityQueryMixin.java +++ b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityQueryMixin.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.QueryResponse; @@ -33,7 +34,6 @@ import org.apache.zest.api.injection.scope.Service; import org.apache.zest.api.query.grammar.OrderBy; import org.apache.zest.api.query.grammar.QuerySpecification; import org.apache.zest.functional.Iterables; -import org.apache.zest.functional.Specification; import org.apache.zest.index.solr.EmbeddedSolrService; import org.apache.zest.index.solr.SolrSearch; import org.apache.zest.spi.query.EntityFinder; @@ -53,7 +53,7 @@ public class SolrEntityQueryMixin private Logger logger = LoggerFactory.getLogger( SolrEntityQueryMixin.class ); @Override - public Iterable findEntities( Class resultType, @Optional Specification whereClause, @Optional OrderBy[] orderBySegments, @Optional Integer firstResult, @Optional Integer maxResults, Map variables ) throws EntityFinderException + public Iterable findEntities( Class resultType, @Optional Predicate whereClause, @Optional OrderBy[] orderBySegments, @Optional Integer firstResult, @Optional Integer maxResults, Map variables ) throws EntityFinderException { try { @@ -99,7 +99,7 @@ public class SolrEntityQueryMixin } @Override - public EntityReference findEntity( Class resultType, @Optional Specification whereClause, Map variables ) throws EntityFinderException + public EntityReference findEntity( Class resultType, @Optional Predicate whereClause, Map variables ) throws EntityFinderException { Iterator iter = findEntities( resultType, whereClause, null, 0, 1, variables ).iterator(); @@ -110,7 +110,7 @@ public class SolrEntityQueryMixin } @Override - public long countEntities( Class resultType, @Optional Specification whereClause, Map variables ) throws EntityFinderException + public long countEntities( Class resultType, @Optional Predicate whereClause, Map variables ) throws EntityFinderException { return Iterables.count( findEntities( resultType, whereClause, null, 0, 1, variables ) ); } http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-solr/src/test/java/org/apache/zest/index/solr/SolrNamedQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/zest/index/solr/SolrNamedQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/zest/index/solr/SolrNamedQueryTest.java index 87fecb2..56e6cc5 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/zest/index/solr/SolrNamedQueryTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/zest/index/solr/SolrNamedQueryTest.java @@ -18,12 +18,12 @@ package org.apache.zest.index.solr; import java.io.File; +import java.util.function.Predicate; import org.junit.Ignore; import org.junit.Rule; import org.apache.zest.api.composite.Composite; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.functional.Specification; import org.apache.zest.library.fileconfig.FileConfigurationOverride; import org.apache.zest.library.fileconfig.FileConfigurationService; import org.apache.zest.test.indexing.AbstractNamedQueryTest; @@ -59,7 +59,7 @@ public class SolrNamedQueryTest } @Override - protected Specification createNamedQueryDescriptor( String queryName, String queryString ) + protected Predicate createNamedQueryDescriptor( String queryName, String queryString ) { return SolrExpressions.search( queryString ); } http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java index 0a650b5..51061a7 100644 --- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java +++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java @@ -25,13 +25,13 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import javax.sql.DataSource; import org.apache.zest.api.common.Optional; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.entity.EntityReference; import org.apache.zest.api.injection.scope.Service; import org.apache.zest.api.query.grammar.OrderBy; -import org.apache.zest.functional.Specification; import org.apache.zest.index.sql.support.api.SQLQuerying; import org.apache.zest.library.sql.common.SQLUtil; import org.apache.zest.spi.query.EntityFinder; @@ -58,7 +58,7 @@ public class SQLEntityFinder } @Override - public long countEntities( Class resultType, @Optional Specification whereClause, Map variables ) + public long countEntities( Class resultType, @Optional Predicate whereClause, Map variables ) throws EntityFinderException { final List values = new ArrayList<>(); @@ -93,7 +93,7 @@ public class SQLEntityFinder @Override public Iterable findEntities( Class resultType, - @Optional Specification whereClause, + @Optional Predicate whereClause, @Optional OrderBy[] orderBySegments, @Optional final Integer firstResult, @Optional final Integer maxResults, @@ -161,7 +161,7 @@ public class SQLEntityFinder @Override public EntityReference findEntity( Class resultType, - @Optional Specification whereClause, + @Optional Predicate whereClause, Map variables ) throws EntityFinderException { http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/api/SQLQuerying.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/api/SQLQuerying.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/api/SQLQuerying.java index b0dde14..774bf88 100644 --- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/api/SQLQuerying.java +++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/api/SQLQuerying.java @@ -20,10 +20,10 @@ package org.apache.zest.index.sql.support.api; import java.sql.PreparedStatement; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import org.apache.zest.api.common.Optional; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.query.grammar.OrderBy; -import org.apache.zest.functional.Specification; import org.apache.zest.spi.query.EntityFinderException; /** @@ -53,7 +53,7 @@ public interface SQLQuerying */ public String constructQuery( // Class resultType, // - @Optional Specification whereClause, // + @Optional Predicate whereClause, // @Optional OrderBy[] orderBySegments, // @Optional Integer firstResult, // @Optional Integer maxResults, // http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/postgresql/PostgreSQLQuerying.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/postgresql/PostgreSQLQuerying.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/postgresql/PostgreSQLQuerying.java index 5ef4ba4..9996389 100644 --- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/postgresql/PostgreSQLQuerying.java +++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/postgresql/PostgreSQLQuerying.java @@ -20,9 +20,9 @@ package org.apache.zest.index.sql.support.postgresql; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import org.apache.zest.api.composite.Composite; import org.apache.zest.api.query.grammar.OrderBy; -import org.apache.zest.functional.Specification; import org.apache.zest.index.sql.support.skeletons.AbstractSQLQuerying; import org.sql.generation.api.grammar.builders.query.QuerySpecificationBuilder; import org.sql.generation.api.grammar.query.QueryExpression; @@ -36,7 +36,7 @@ public class PostgreSQLQuerying protected QueryExpression finalizeQuery( SQLVendor sqlVendor, QuerySpecificationBuilder specBuilder, Class resultType, - Specification whereClause, + Predicate whereClause, OrderBy[] orderBySegments, Integer firstResult, Integer maxResults,