jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JExportsDirective.java
changeset 42124 640a383428fb
equal deleted inserted replaced
42002:3ee4e7827413 42124:640a383428fb
       
     1 /*
       
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 package com.sun.codemodel.internal;
       
    27 
       
    28 // TODO: Implement "[to ModuleName {, ModuleName}]".
       
    29 // Only minimal form of exports directive is needed now so it was not implemented in full form.
       
    30 /**
       
    31  * Represents a Java module {@code exports} directive.
       
    32  * For example {@code "exports foo.bar;"}.
       
    33  * @author Tomas Kraus
       
    34  */
       
    35 
       
    36 public class JExportsDirective extends JModuleDirective {
       
    37 
       
    38     /**
       
    39      * Creates an instance of Java module {@code exports} directive.
       
    40      * @param name name of package to be exported in this directive.
       
    41      * @throws IllegalArgumentException if the name argument is {@code null}.
       
    42      */
       
    43     JExportsDirective(final String name) {
       
    44         super(name);
       
    45     }
       
    46 
       
    47     /**
       
    48      * Gets the type of this module directive.
       
    49      * @return type of this module directive. Will always return {@code Type.ExportsDirective}.
       
    50      */
       
    51     @Override
       
    52     public Type getType() {
       
    53         return Type.ExportsDirective;
       
    54     }
       
    55 
       
    56     /**
       
    57      * Print source code of this module directive.
       
    58      * @param f Java code formatter.
       
    59      * @return provided instance of Java code formatter.
       
    60      */
       
    61     @Override
       
    62     public JFormatter generate(final JFormatter f) {
       
    63         f.p("exports").p(name).p(';').nl();
       
    64         return f;
       
    65     }
       
    66 
       
    67 }