@Override
   public boolean match(String attributeValue) {
      if (attributeValue == null) {
         return false;
      }

      switch (type) {
         case Equals:
            return attributeValue.equals(value);
         case StartsWith:
            return (length == -1 || length == attributeValue.length()) && attributeValue.startsWith(value);
         case EndsWith:
            return (length == -1 || length == attributeValue.length()) && attributeValue.endsWith(value);
         case Contains:
            return attributeValue.contains(value);
         case Regexp:
            return regexPattern.matcher(attributeValue).matches();
         default:
            throw new IllegalStateException("Unexpected type " + type);
      }
   }
@Test
   public void testDegeneratedStartsWith() {
      assertTrue(new LikeCondition("ab%").match("ab"));
      assertTrue(new LikeCondition("ab%").match("abx"));
      assertTrue(new LikeCondition("ab%").match("abxx"));
      assertFalse(new LikeCondition("ab%").match("xab"));
      assertFalse(new LikeCondition("ab%").match("axb"));

      assertTrue(new LikeCondition("ab_").match("abc"));
      assertFalse(new LikeCondition("ab_").match("ab"));
      assertFalse(new LikeCondition("ab_").match("abxx"));
      assertFalse(new LikeCondition("ab_").match("xab"));
      assertFalse(new LikeCondition("ab_").match("xaby"));
   }