List of usage examples for com.google.common.collect ClassToInstanceMap isEmpty
boolean isEmpty();
From source file:org.opendaylight.mdsal.binding.testutils.XtendYangBeanGenerator.java
private Optional<ClassToInstanceMap<Augmentation<?>>> getAugmentations(Object bean) { if (bean instanceof Augmentable<?>) { Augmentable<?> augmentable = (Augmentable<?>) bean; ClassToInstanceMap<Augmentation<?>> augmentables = augmentableExtension.getAugmentations(augmentable); if (!augmentables.isEmpty()) { return Optional.of(augmentables); }/*ww w. jav a2s . c o m*/ } return Optional.empty(); }
From source file:com.torodb.torod.mongodb.translator.BasicQueryTranslator.java
private QueryCriteria translateSubQueries(@Nonnull AttributeReference attRefAcum, @Nonnull BsonValue uncastedArg, @Nonnull ExpModifications modifications) throws UserToroException { if (!uncastedArg.isDocument()) { throw new ToroImplementationException("A bson object was expected"); }//www . ja v a2s .co m BsonDocument arg = uncastedArg.asDocument(); if (arg.size() == 1) { Entry<?> entry = arg.getFirstEntry(); return translateSubQuery(attRefAcum, entry.getKey(), entry.getValue(), modifications); } else { ConjunctionBuilder cb = new ConjunctionBuilder(); ExpModifications newModifiers = new ExpModifications(arg); for (Entry<?> entry : arg) { if (isExpModifier(entry.getKey())) { continue; } cb.add(translateSubQuery(attRefAcum, entry.getKey(), entry.getValue(), newModifiers)); } ClassToInstanceMap<ExpModifier> notConsumedModifiers = newModifiers.getNotConsumedModifiers(); if (!notConsumedModifiers.isEmpty()) { throw new NotConsumedExpModifierException(notConsumedModifiers); } return cb.build(); } }
From source file:com.torodb.torod.mongodb.translator.BasicQueryTranslator.java
private QueryCriteria translateImplicitAnd(@Nonnull AttributeReference attRefAcum, @Nonnull BsonDocument exp) throws UserToroException { if (exp.isEmpty()) { return TrueQueryCriteria.getInstance(); }//from w w w.j a v a 2 s .c om if (exp.size() == 1) { Entry<?> entry = exp.getFirstEntry(); String key = entry.getKey(); if (isExpModifier(key)) { ExpModifications newModifiers = new ExpModifications(exp); ClassToInstanceMap<ExpModifier> notConsumedModifiers = newModifiers.getNotConsumedModifiers(); assert !notConsumedModifiers.isEmpty(); throw new NotConsumedExpModifierException(notConsumedModifiers); } BsonValue uncastedArg = exp.get(key); return translateExp(attRefAcum, key, uncastedArg, ExpModifications.NO_MODIFICATIONS); } ConjunctionBuilder conjunctionBuilder = new ConjunctionBuilder(); ExpModifications newModifiers = new ExpModifications(exp); //TODO: Constraint merged ands, ors, nors and subqueries and equalities for (Entry<?> entry : exp) { String key = entry.getKey(); if (isExpModifier(key)) { continue; } BsonValue uncastedArg = entry.getValue(); conjunctionBuilder.add(translateExp(attRefAcum, key, uncastedArg, newModifiers)); } ClassToInstanceMap<ExpModifier> notConsumedModifiers = newModifiers.getNotConsumedModifiers(); if (!notConsumedModifiers.isEmpty()) { throw new NotConsumedExpModifierException(notConsumedModifiers); } return conjunctionBuilder.build(); }