samples/genericconstructor/src-factory/org/apidesign/template/Template.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 03 Apr 2020 16:32:36 +0200
changeset 416 9ed8788a1a4e
parent 142 e220ab4a7afa
permissions -rw-r--r--
Using HTTPS to download the libraries
     1 package org.apidesign.template;
     2 
     3 // BEGIN: generics.constructor.template3
     4 public final class Template<T> extends Object {
     5     private final Class<T> type;
     6 
     7     public Template(Class<T> type) { this.type = type; }
     8     public Class<T> getType() { return type; }
     9 
    10     @Deprecated
    11     @SuppressWarnings("unchecked")
    12     public Template() { this((Class<T>)Object.class); }
    13     
    14     public static Template<Object> create() {
    15         return new Template<Object>(Object.class);
    16     }
    17 } 
    18 // END: generics.constructor.template3