1 2 12 package com.versant.core.ejb.query; 13 14 17 public class ParameterNode extends Node { 18 19 private String name; 20 private int position; 21 private ResolveContext.ParamUsage usage; 22 23 public ParameterNode(boolean positional, String name) { 24 this.name = name; 25 if (positional) { 26 position = Integer.parseInt(name); 27 if (position <= 0) { 28 throw new IllegalArgumentException ( 29 "Invalid positional parameter: " + position); 30 } 31 } else { 32 position = -1; 33 } 34 } 35 36 public boolean isPositional() { 37 return position >= 1; 38 } 39 40 44 public String getName() { 45 return name; 46 } 47 48 51 public int getPosition() { 52 return position; 53 } 54 55 public Object arrive(NodeVisitor v, Object msg) { 56 return v.arriveParameterNode(this, msg); 57 } 58 59 public String toStringImp() { 60 return (isPositional() ? "?" : ":") + name; 61 } 62 63 public void resolve(ResolveContext rc) { 64 usage = rc.addParameterNode(this); 65 } 66 67 70 public ResolveContext.ParamUsage getUsage() { 71 return usage; 72 } 73 74 } 75 76 | Popular Tags |