org.datanucleus.api.jdo.query.MapExpressionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datanucleus-api-jdo Show documentation
Show all versions of datanucleus-api-jdo Show documentation
Plugin providing DataNucleus implementation of the JDO API.
/**********************************************************************
Copyright (c) 2010 Andy Jefferson and others. All rights reserved.
Licensed 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.
Contributors:
...
**********************************************************************/
package org.datanucleus.api.jdo.query;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.jdo.query.BooleanExpression;
import javax.jdo.query.Expression;
import javax.jdo.query.MapExpression;
import javax.jdo.query.NumericExpression;
import javax.jdo.query.PersistableExpression;
import org.datanucleus.query.expression.InvokeExpression;
import org.datanucleus.query.expression.Literal;
/**
* Implementation of a MapExpression
*/
public class MapExpressionImpl, K, V> extends ExpressionImpl implements MapExpression
{
public MapExpressionImpl(PersistableExpression parent, String name)
{
super(parent, name);
}
public MapExpressionImpl(Class cls, String name, ExpressionType type)
{
super(cls, name, type);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#containsEntry(java.util.Map.Entry)
*/
public BooleanExpression containsEntry(Entry entry)
{
List args = new ArrayList();
args.add(new Literal(entry));
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "containsEntry", args);
return new BooleanExpressionImpl(invokeExpr);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#containsEntry(org.datanucleus.query.typesafe.Expression)
*/
public BooleanExpression containsEntry(Expression> expr)
{
List args = new ArrayList();
args.add(((ExpressionImpl)expr).getQueryExpression());
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "containsEntry", args);
return new BooleanExpressionImpl(invokeExpr);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#containsKey(org.datanucleus.query.typesafe.Expression)
*/
public BooleanExpression containsKey(Expression expr)
{
List args = new ArrayList();
args.add(((ExpressionImpl)expr).getQueryExpression());
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "containsKey", args);
return new BooleanExpressionImpl(invokeExpr);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#containsKey(java.lang.Object)
*/
public BooleanExpression containsKey(K key)
{
List args = new ArrayList();
args.add(new Literal(key));
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "containsKey", args);
return new BooleanExpressionImpl(invokeExpr);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#containsValue(org.datanucleus.query.typesafe.Expression)
*/
public BooleanExpression containsValue(Expression expr)
{
List args = new ArrayList();
args.add(((ExpressionImpl)expr).getQueryExpression());
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "containsValue", args);
return new BooleanExpressionImpl(invokeExpr);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#containsValue(java.lang.Object)
*/
public BooleanExpression containsValue(V value)
{
List args = new ArrayList();
args.add(new Literal(value));
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "containsValue", args);
return new BooleanExpressionImpl(invokeExpr);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#isEmpty()
*/
public BooleanExpression isEmpty()
{
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "isEmpty", null);
return new BooleanExpressionImpl(invokeExpr);
}
/* (non-Javadoc)
* @see org.datanucleus.query.typesafe.MapExpression#size()
*/
public NumericExpression size()
{
org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "size", null);
return new NumericExpressionImpl(invokeExpr);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy