@Test public void testRemoveUnsetConstraint() throws Throwable { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table")); Constraints.remove(desc); Constraints.remove(desc, AlsoWorks.class); }
public static void remove(HTableDescriptor desc) { disable(desc); List<ImmutableBytesWritable> keys = new ArrayList<ImmutableBytesWritable>(); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e : desc .getValues().entrySet()) { String key = Bytes.toString((e.getKey().get())); String[] className = CONSTRAINT_HTD_ATTR_KEY_PATTERN.split(key); if (className.length == 2) { keys.add(e.getKey()); } } for (ImmutableBytesWritable key : keys) { desc.remove(key); } }
Constraints { public static void remove(HTableDescriptor desc) { disable(desc); List<ImmutableBytesWritable> keys = new ArrayList<ImmutableBytesWritable>(); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e : desc .getValues().entrySet()) { String key = Bytes.toString((e.getKey().get())); String[] className = CONSTRAINT_HTD_ATTR_KEY_PATTERN.split(key); if (className.length == 2) { keys.add(e.getKey()); } } for (ImmutableBytesWritable key : keys) { desc.remove(key); } } }
Constraints { public static void remove(HTableDescriptor desc) { disable(desc); List<ImmutableBytesWritable> keys = new ArrayList<ImmutableBytesWritable>(); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e : desc .getValues().entrySet()) { String key = Bytes.toString((e.getKey().get())); String[] className = CONSTRAINT_HTD_ATTR_KEY_PATTERN.split(key); if (className.length == 2) { keys.add(e.getKey()); } } for (ImmutableBytesWritable key : keys) { desc.remove(key); } } private  Constraints(); }
Constraints { public static void remove(HTableDescriptor desc) { disable(desc); List<ImmutableBytesWritable> keys = new ArrayList<ImmutableBytesWritable>(); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e : desc .getValues().entrySet()) { String key = Bytes.toString((e.getKey().get())); String[] className = CONSTRAINT_HTD_ATTR_KEY_PATTERN.split(key); if (className.length == 2) { keys.add(e.getKey()); } } for (ImmutableBytesWritable key : keys) { desc.remove(key); } } private  Constraints(); static void enable(HTableDescriptor desc); static void disable(HTableDescriptor desc); static void remove(HTableDescriptor desc); static boolean has(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static void add(HTableDescriptor desc,
      Class<? extends Constraint>... constraints); static void add(HTableDescriptor desc,
      Pair<Class<? extends Constraint>, Configuration>... constraints); static void add(HTableDescriptor desc,
      Class<? extends Constraint> constraint, Configuration conf); static void setConfiguration(HTableDescriptor desc,
      Class<? extends Constraint> clazz, Configuration configuration); static void remove(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static void enableConstraint(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static void disableConstraint(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static boolean enabled(HTableDescriptor desc,
      Class<? extends Constraint> clazz); }
Constraints { public static void remove(HTableDescriptor desc) { disable(desc); List<ImmutableBytesWritable> keys = new ArrayList<ImmutableBytesWritable>(); for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e : desc .getValues().entrySet()) { String key = Bytes.toString((e.getKey().get())); String[] className = CONSTRAINT_HTD_ATTR_KEY_PATTERN.split(key); if (className.length == 2) { keys.add(e.getKey()); } } for (ImmutableBytesWritable key : keys) { desc.remove(key); } } private  Constraints(); static void enable(HTableDescriptor desc); static void disable(HTableDescriptor desc); static void remove(HTableDescriptor desc); static boolean has(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static void add(HTableDescriptor desc,
      Class<? extends Constraint>... constraints); static void add(HTableDescriptor desc,
      Pair<Class<? extends Constraint>, Configuration>... constraints); static void add(HTableDescriptor desc,
      Class<? extends Constraint> constraint, Configuration conf); static void setConfiguration(HTableDescriptor desc,
      Class<? extends Constraint> clazz, Configuration configuration); static void remove(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static void enableConstraint(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static void disableConstraint(HTableDescriptor desc,
      Class<? extends Constraint> clazz); static boolean enabled(HTableDescriptor desc,
      Class<? extends Constraint> clazz);  }