org.glassfish.copyright
Class TextCopyright

java.lang.Object
  extended by org.glassfish.copyright.AbstractCopyright
      extended by org.glassfish.copyright.TextCopyright

public class TextCopyright
extends AbstractCopyright


Field Summary
 
Fields inherited from class org.glassfish.copyright.AbstractCopyright
allrights, c, licensor, thisYear, ypat
 
Constructor Summary
TextCopyright(Copyright c)
           
 
Method Summary
protected  boolean matches(Pattern pat, String s)
          Does the string match the pattern? Since we don't know where the comment text might end, we just insist that it match starting at the beginning of the text.
protected  String readComment(BufferedReader r)
          Read the first comment block in a non-Java file.
protected  void repair(File file, String comment, org.glassfish.copyright.AbstractCopyright.RepairType type)
          Repair the c.errors in the file.
protected  void replaceCopyright(BufferedReader in, BufferedWriter out, String comment, String lastChanged)
          Skip the first comment block, replacing it with the correct copyright.
protected  boolean supports(File file)
          Is this a plain text file?
protected  String toComment(String comment)
          Convert the comment text to the appropriate syntax.
protected  void updateCopyright(BufferedReader in, BufferedWriter out, String lastChanged)
          Update the existing copyright statement, changing the copyright year to include lastChanged.
 
Methods inherited from class org.glassfish.copyright.AbstractCopyright
addCopyrightDate, checkCopyright, copy, err, findPrefix, fixCopyright, isModified, lastChanged, startsWith, startsWith, strip, warnCopyright, writeCopyright
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextCopyright

public TextCopyright(Copyright c)
Method Detail

supports

protected boolean supports(File file)
Is this a plain text file?

Specified by:
supports in class AbstractCopyright

readComment

protected String readComment(BufferedReader r)
                      throws IOException
Read the first comment block in a non-Java file. Don't know how to do this so just return up to the first 100 lines.

Specified by:
readComment in class AbstractCopyright
Throws:
IOException

matches

protected boolean matches(Pattern pat,
                          String s)
Does the string match the pattern? Since we don't know where the comment text might end, we just insist that it match starting at the beginning of the text.

Overrides:
matches in class AbstractCopyright

repair

protected void repair(File file,
                      String comment,
                      org.glassfish.copyright.AbstractCopyright.RepairType type)
               throws IOException
Repair the c.errors in the file. Repair cases and strategy: Missing copyright Insert correct copyright Wrong copyright Try to extract copyright date. Insert correct copyright. Wrong date Update existing date in existing copyright.

Overrides:
repair in class AbstractCopyright
Throws:
IOException

replaceCopyright

protected void replaceCopyright(BufferedReader in,
                                BufferedWriter out,
                                String comment,
                                String lastChanged)
                         throws IOException
Skip the first comment block, replacing it with the correct copyright. If the file starts with a "package" statement, save it and write it out after the new copyright.

Specified by:
replaceCopyright in class AbstractCopyright
Throws:
IOException

updateCopyright

protected void updateCopyright(BufferedReader in,
                               BufferedWriter out,
                               String lastChanged)
                        throws IOException
Update the existing copyright statement, changing the copyright year to include lastChanged.

Specified by:
updateCopyright in class AbstractCopyright
Throws:
IOException

toComment

protected String toComment(String comment)
Convert the comment text to the appropriate syntax.

Specified by:
toComment in class AbstractCopyright


Copyright © 2012 GlassFish Community. All Rights Reserved.