class ExtensibleFilter implements Filter {

  @Override
  public DEREncoder getEncoder()
  {
    // CheckStyle:MagicNumber OFF
    final DEREncoder[] encoders = new DEREncoder[4];
    encoders[0] = matchingRuleID != null ? new OctetStringType(new ContextDERTag(1, false), matchingRuleID) : null;
    encoders[1] = attributeDesc != null ? new OctetStringType(new ContextDERTag(2, false), attributeDesc) : null;
    encoders[2] = assertionValue != null ? new OctetStringType(new ContextDERTag(3, false), assertionValue) : null;
    encoders[3] = dnAttributes ? new BooleanType(new ContextDERTag(4, false), true) : null;
    // CheckStyle:MagicNumber ON
    return new ConstructedDEREncoder(
      new ContextDERTag(Filter.Type.EXTENSIBLE_MATCH.ordinal(), true),
      Stream.of(encoders).filter(Objects::nonNull).toArray(DEREncoder[]::new));
  }

  public  ExtensibleFilter(final String matchingRule, final String type, final String value);
  public  ExtensibleFilter(final String matchingRule, final String type, final String value, final boolean dnAttrs);
  public  ExtensibleFilter(final String matchingRule, final String type, final byte[] value);
  public  ExtensibleFilter(final String matchingRule, final String type, final byte[] value, final boolean dnAttrs);

}