示例#1
0
 private void assertClassHandler() {
   int id1 = storeItem();
   int id2 = storeItem();
   int smallerID = Math.min(id1, id2);
   int biggerID = Math.max(id1, id2);
   ClassMetadata classMetadata = new ClassMetadata(container(), reflector().forClass(Item.class));
   assertHandlerComparison(
       (Comparable4) classMetadata.typeHandler(), new Integer(smallerID), new Integer(biggerID));
 }
示例#2
0
 private ClassMetadata singleClassConstraint() {
   if (requiresSort()) {
     return null;
   }
   QConClass clazzconstr = classConstraint();
   if (clazzconstr == null) {
     return null;
   }
   ClassMetadata clazz = clazzconstr._classMetadata;
   if (clazz == null) {
     return null;
   }
   if (clazzconstr.hasChildren() || clazz.isArray()) {
     return null;
   }
   return clazz;
 }
示例#3
0
  // Our QConPath objects are just placeholders to fields,
  // so the parents are reachable.
  // If we find a "real" constraint, we throw the QPath
  // out and replace it with the other constraint.
  private void morph(BooleanByRef removeExisting, QCon newConstraint, ReflectClass claxx) {
    boolean mayMorph = true;
    if (claxx != null) {
      ClassMetadata yc = i_trans.container().produceClassMetadata(claxx);
      if (yc != null) {
        Iterator4 i = iterateChildren();
        while (i.moveNext()) {
          QField qf = ((QCon) i.current()).getField();
          if (!yc.hasField(i_trans.container(), qf.name())) {
            mayMorph = false;
            break;
          }
        }
      }
    }

    if (mayMorph) {
      Iterator4 j = iterateChildren();
      while (j.moveNext()) {
        newConstraint.addConstraint((QCon) j.current());
      }
      if (hasJoins()) {
        Iterator4 k = iterateJoins();
        while (k.moveNext()) {
          QConJoin qcj = (QConJoin) k.current();
          qcj.exchangeConstraint(this, newConstraint);
          newConstraint.addJoin(qcj);
        }
      }
      i_parent.exchangeConstraint(this, newConstraint);
      removeExisting.value = true;

    } else {
      i_parent.addConstraint(newConstraint);
    }
  }
示例#4
0
 private Constraint addInterfaceConstraint(ReflectClass claxx) {
   Collection4 classes = stream().classCollection().forInterface(claxx);
   if (classes.size() == 0) {
     QConClass qcc = new QConClass(_trans, null, null, claxx);
     addConstraint(qcc);
     return qcc;
   }
   Iterator4 i = classes.iterator();
   Constraint constr = null;
   while (i.moveNext()) {
     ClassMetadata classMetadata = (ClassMetadata) i.current();
     ReflectClass classMetadataClaxx = classMetadata.classReflector();
     if (classMetadataClaxx != null) {
       if (!classMetadataClaxx.isInterface()) {
         if (constr == null) {
           constr = constrain(classMetadataClaxx);
         } else {
           constr = constr.or(constrain(classMetadata.classReflector()));
         }
       }
     }
   }
   return constr;
 }