1 19 package org.apache.cayenne.access.jdbc; 20 21 import java.io.IOException ; 22 import java.io.Writer ; 23 24 import org.apache.velocity.context.InternalContextAdapter; 25 26 35 public class BindObjectNotEqualDirective extends BindObjectEqualDirective { 36 37 public String getName() { 38 return "bindObjectNotEqual"; 39 } 40 41 protected void renderColumn( 42 InternalContextAdapter context, 43 Writer writer, 44 Object columnName, 45 int columnIndex) throws IOException { 46 47 if (columnIndex > 0) { 48 writer.write(" OR "); 49 } 50 51 writer.write(columnName.toString()); 52 } 53 54 protected void render( 55 InternalContextAdapter context, 56 Writer writer, 57 ParameterBinding binding) throws IOException { 58 59 if (binding.getValue() != null) { 60 bind(context, binding); 61 writer.write("<> ?"); 62 } 63 else { 64 writer.write("IS NOT NULL"); 65 } 66 } 67 } 68 | Popular Tags |