private Object newInstance(Class clazz) { ReflectClass classReflector = reflector().forClass(clazz); Object obj = classReflector.newInstance(); if (obj == null) { throw new IllegalArgumentException("No usable constructor for Class " + clazz); } return obj; }
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; }
private Constraint addClassConstraint(ReflectClass claxx) { if (isTheObjectClass(claxx)) { return null; } if (claxx.isInterface()) { return addInterfaceConstraint(claxx); } final Collection4 newConstraints = introduceClassConstrain(claxx); if (newConstraints.isEmpty()) { QConClass qcc = new QConClass(_trans, claxx); addConstraint(qcc); return qcc; } return toConstraint(newConstraints); }
private boolean isTheObjectClass(ReflectClass claxx) { return claxx.equals(stream()._handlers.ICLASS_OBJECT); }