Share Class Type
[mdsal.git] / binding / mdsal-binding-generator-util / src / main / java / org / opendaylight / mdsal / binding / model / util / Types.java
index 697a8952121e83cd91eb62bd370432f76b959dd7..1f0226b82cc2d97feeda0efa1fc378dfbbbfa715 100644 (file)
@@ -57,6 +57,7 @@ public final class Types {
     public static final ConcreteType BYTE_ARRAY = typeForClass(byte[].class);
     public static final ConcreteType CHAR_ARRAY = typeForClass(char[].class);
 
+    private static final ConcreteType CLASS = typeForClass(Class.class);
     private static final ConcreteType OBJECT = typeForClass(Object.class);
     private static final ConcreteType PRIMITIVE_VOID = typeForClass(void.class);
     private static final ConcreteType SERIALIZABLE = typeForClass(Serializable.class);
@@ -67,6 +68,18 @@ public final class Types {
     private Types() {
     }
 
+    /**
+     * Returns an instance of {@link ParameterizedType} which represents JAVA <code>java.lang.Class</code> type
+     * specialized to specified type.
+     *
+     * @param type Type for which to specialize
+     * @return A parameterized type corresponding to {@code Class<Type>}
+     * @throws NullPointerException if {@code type} is null
+     */
+    public static ParameterizedType classType(final Type type) {
+        return parameterizedTypeFor(CLASS, type);
+    }
+
     /**
      * Returns an instance of {@link ConcreteType} which represents JAVA <code>java.lang.Void</code> type.
      *