Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: CompoundPredicate hibernate to support XOR operations

  1. #1
    Junior Member
    Join Date
    Mar 2019
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default CompoundPredicate hibernate to support XOR operations

    Hi,

    I am referring the below code as I am working on one my projects which helps you track your mobile number in India ( https://imobilenumbertracker.com ):
    public Predicate isFalse(Expression<Boolean> expression) {
    		if ( CompoundPredicate.class.isInstance( expression ) ) {
    			final CompoundPredicate predicate = (CompoundPredicate) expression;
    			if ( predicate.getExpressions().size() == 0 ) {
    				return new BooleanStaticAssertionPredicate(
    						this,
    						predicate.getOperator() == Predicate.BooleanOperator.OR
    				);
    			}
    			predicate.not();
    			return predicate;
    		}
    		else if ( Predicate.class.isInstance( expression ) ) {
    			final Predicate predicate = (Predicate) expression;
    			predicate.not();
    			return predicate;
    		}
    		return new BooleanAssertionPredicate( this, expression, Boolean.FALSE );
    	}



    I am trying to understand if compoundPredicate it provides XOR operation as well.

    --- Update ---

    Source of the above code : Source : http://www.zgrepcode.com/examples/hi...mplementations
    Last edited by dylan009; April 24th, 2020 at 06:27 AM. Reason: Adding required resource

Similar Threads

  1. Replies: 2
    Last Post: January 12th, 2013, 12:16 PM
  2. XOR encryption algorithm code clean-up
    By aesguitar in forum Java Theory & Questions
    Replies: 2
    Last Post: August 2nd, 2012, 07:21 PM
  3. Replies: 1
    Last Post: September 30th, 2010, 02:36 PM
  4. Hibernate support for Oracle 11g
    By domminnik in forum JDBC & Databases
    Replies: 0
    Last Post: April 16th, 2010, 08:36 AM