SingleFieldConstraint sfc1 = new SingleFieldConstraint( "field2" );
sfc1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
sfc1.setFieldType( DataType.TYPE_STRING );
sfc1.setOperator( "==" );
sfc1.setValue( "$f2" );
fp.addConstraint( sfc1 );
FactPattern fp2 = new FactPattern( "java.util.List" );
SingleFieldConstraint sfc2 = new SingleFieldConstraint( "size" );
sfc2.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
sfc2.setFieldType( DataType.TYPE_NUMERIC_INTEGER );