001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2010 Sun Microsystems, Inc. 015 */ 016 017package org.forgerock.opendj.ldap.controls; 018 019import org.forgerock.opendj.ldap.DecodeException; 020import org.forgerock.opendj.ldap.DecodeOptions; 021 022/** 023 * A factory interface for decoding a control as a control of specific type. 024 * 025 * @param <C> 026 * The type of control decoded by this control decoder. 027 */ 028public interface ControlDecoder<C extends Control> { 029 /** 030 * Decodes the provided control as a {@code Control} of type {@code C}. 031 * 032 * @param control 033 * The control to be decoded. 034 * @param options 035 * The set of decode options which should be used when decoding 036 * the control. 037 * @return The decoded control. 038 * @throws DecodeException 039 * If the control contained the wrong OID, it did not have a 040 * value, or if its value could not be decoded. 041 */ 042 C decodeControl(Control control, DecodeOptions options) throws DecodeException; 043 044 /** 045 * Returns the numeric OID associated with this control decoder. 046 * 047 * @return The numeric OID associated with this control decoder. 048 */ 049 String getOID(); 050}