/** * Creates a constraint for a path to be a particular subclass (type). The type should be * an unqualified class name that is a valid subclass of the end element of the path. * * @param path the path to apply the constraint to * @param type an unqualified class name of the subclass * @return a new PathConstraint object */ public static PathConstraintSubclass type(String path, String type) { return new PathConstraintSubclass(path, type); }
/** * A static method to get the type of this constraint if it is a * sub-class constraint, or otherwise return null. * @param con The constraint to get the type of. * @return The type, or null. */ public static String getType(PathConstraint con) { if (con instanceof PathConstraintSubclass) { return ((PathConstraintSubclass) con).getType(); } else { return null; } } }
((PathConstraintLookup) pathConstraint).getExtraValue()); } else if (pathConstraint instanceof PathConstraintSubclass) { newPathConstraint = new PathConstraintSubclass(newPath, ((PathConstraintSubclass) pathConstraint).getType()); } else if (pathConstraint instanceof PathConstraintLoop) { newPathConstraint = new PathConstraintLoop(newPath, op,
/** * A static method to get the type of this constraint if it is a * sub-class constraint, or otherwise return null. * @param con The constraint to get the type of. * @return The type, or null. */ public static String getType(PathConstraint con) { if (con instanceof PathConstraintSubclass) { return ((PathConstraintSubclass) con).getType(); } else { return null; } } }
((PathConstraintLookup) pathConstraint).getExtraValue()); } else if (pathConstraint instanceof PathConstraintSubclass) { newPathConstraint = new PathConstraintSubclass(newPath, ((PathConstraintSubclass) pathConstraint).getType()); } else if (pathConstraint instanceof PathConstraintLoop) { newPathConstraint = new PathConstraintLoop(newPath, op,
/** * Creates a constraint for a path to be a particular subclass (type). The type should be * an unqualified class name that is a valid subclass of the end element of the path. * * @param path the path to apply the constraint to * @param type an unqualified class name of the subclass * @return a new PathConstraint object */ public static PathConstraintSubclass type(String path, String type) { return new PathConstraintSubclass(path, type); }
/** * Produces a Path object from the given path String, using subclass information from the query. * Note that this method does not verify the query, but merely attempts to extract as much sane * subclass information as possible to construct the Path. * * @param path the String path * @return a Path object * @throws PathException if something goes wrong, or if the path is in an invalid format */ public synchronized Path makePath(String path) throws PathException { Map<String, String> lSubclasses = new HashMap<String, String>(); for (PathConstraint subclass : constraints.keySet()) { if (subclass instanceof PathConstraintSubclass) { lSubclasses.put(subclass.getPath(), ((PathConstraintSubclass) subclass).getType()); } } return new Path(model, path, lSubclasses); }
public RubyWhereClause(String path, String type) throws InvalidQueryException { this.pc = new PathConstraintSubclass(path, type); parse(); }
if (subclasses.containsKey(subclass.getPath())) { problems.add("Cannot have multiple subclass constraints on path " + subclass.getPath()); continue; subclassPath = new Path(model, subclass.getPath(), subclasses); } catch (PathException e) { problems.add("Path " + subclass.getPath() + " (from subclass constraint) is not in" + " the model"); continue; problems.add("Root node " + subclass.getPath() + " may not have a subclass constraint"); continue; problems.add("Path " + subclass.getPath() + " (from subclass constraint) must not " + "be an attribute"); continue; ClassDescriptor subclassDesc = model.getClassDescriptorByName(subclass.getType()); if (model.isGeneratedClassesAvailable()) { Class<?> parentClassType = subclassPath.getEndClassDescriptor().getType(); Class<?> subclassType = (subclassDesc == null ? null : subclassDesc.getType()); if (subclassType == null) { problems.add("Subclass " + subclass.getType() + " (for path " + subclass.getPath() + ") is not in the model"); continue;
/** * Produces a Path object from the given path String, using subclass information from the query. * Note that this method does not verify the query, but merely attempts to extract as much sane * subclass information as possible to construct the Path. * * @param path the String path * @return a Path object * @throws PathException if something goes wrong, or if the path is in an invalid format */ public synchronized Path makePath(String path) throws PathException { Map<String, String> lSubclasses = new HashMap<String, String>(); for (PathConstraint subclass : constraints.keySet()) { if (subclass instanceof PathConstraintSubclass) { lSubclasses.put(subclass.getPath(), ((PathConstraintSubclass) subclass).getType()); } } return new Path(model, path, lSubclasses); }
public RubyWhereClause(String path, String type) throws InvalidQueryException { this.pc = new PathConstraintSubclass(path, type); parse(); }
if (subclasses.containsKey(subclass.getPath())) { problems.add("Cannot have multiple subclass constraints on path " + subclass.getPath()); continue; subclassPath = new Path(model, subclass.getPath(), subclasses); } catch (PathException e) { problems.add("Path " + subclass.getPath() + " (from subclass constraint) is not in" + " the model"); continue; problems.add("Root node " + subclass.getPath() + " may not have a subclass constraint"); continue; problems.add("Path " + subclass.getPath() + " (from subclass constraint) must not " + "be an attribute"); continue; ClassDescriptor subclassDesc = model.getClassDescriptorByName(subclass.getType()); if (model.isGeneratedClassesAvailable()) { Class<?> parentClassType = subclassPath.getEndClassDescriptor().getType(); Class<?> subclassType = (subclassDesc == null ? null : subclassDesc.getType()); if (subclassType == null) { problems.add("Subclass " + subclass.getType() + " (for path " + subclass.getPath() + ") is not in the model"); continue;
} else if (constraint.getKey() instanceof PathConstraintSubclass) { writer.writeAttribute("type", ((PathConstraintSubclass) constraint.getKey()) .getType()); } else if (constraint.getKey() instanceof PathConstraintBag) { writer.writeAttribute("op", "" + constraint.getKey().getOp());
String type = attrs.getValue("type"); if (type != null) { query.addConstraint(new PathConstraintSubclass(path, type)); } else { path = path.replace(':', '.');
Map<String, String> trimmedSubclasses = new HashMap<String, String>( subClasses); trimmedSubclasses.remove(subclass.getPath()); Path path = new Path(model, subclass.getPath(), trimmedSubclasses); if (path.getEndClassDescriptor().getUnqualifiedName() .equals(subclass.getType())) { query.removeConstraint(subclass);
} else if (constraint.getKey() instanceof PathConstraintSubclass) { writer.writeAttribute("type", ((PathConstraintSubclass) constraint.getKey()) .getType()); } else if (constraint.getKey() instanceof PathConstraintBag) { writer.writeAttribute("op", "" + constraint.getKey().getOp());