View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.model.schema.syntaxCheckers;
21  
22  
23  import org.apache.directory.api.ldap.model.constants.SchemaConstants;
24  import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
25  
26  
27  /**
28   * A SyntaxChecker which verifies that a value is a Octet String according to RFC 4517.
29   * <p>
30   * From RFC 4517 :
31   * <pre>
32   * OctetString = *OCTET
33   * </pre>
34   * From RFC 4512 :
35   * <pre>
36   * OCTET   = %x00-FF ; Any octet (8-bit data unit)
37   * </pre>
38   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
39   */
40  @SuppressWarnings("serial")
41  public final class OctetStringSyntaxChecker extends SyntaxChecker
42  {
43      /**
44       * A static instance of OctetStringSyntaxChecker
45       */
46      public static final OctetStringSyntaxChecker INSTANCE = 
47          new OctetStringSyntaxChecker( SchemaConstants.OCTET_STRING_SYNTAX );
48      
49      /**
50       * A static Builder for this class
51       */
52      public static final class Builder extends SCBuilder<OctetStringSyntaxChecker>
53      {
54          /**
55           * The Builder constructor
56           */
57          private Builder()
58          {
59              super( SchemaConstants.OCTET_STRING_SYNTAX );
60          }
61          
62          
63          /**
64           * Create a new instance of OctetStringSyntaxChecker
65           * @return A new instance of OctetStringSyntaxChecker
66           */
67          @Override
68          public OctetStringSyntaxChecker build()
69          {
70              return new OctetStringSyntaxChecker( oid );
71          }
72      }
73  
74      
75      /**
76       * Creates a new instance of OctetStringSyntaxChecker, with a specific OID
77       * 
78       * @param oid The Syntax's OID 
79       */
80      private OctetStringSyntaxChecker( String oid )
81      {
82          super( oid );
83      }
84  
85      
86      /**
87       * @return An instance of the Builder for this class
88       */
89      public static Builder builder()
90      {
91          return new Builder();
92      }
93  }