<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.3//EN" "document-v13.dtd">
<document>
    <header>
        <title>&#37204;&#12387;&#12401;&#12425;&#12356;&#12394;&#12364;&#12425;&#12398;&#12362;&#21193;&#24375;</title>
        <authors>
            <person name="&#30693;&#20037;&#21644;&#37070;" email="chikkun@chikkun.com"/>
        </authors>
        <abstract>&#12414;&#12354;&#12289;&#12494;&#12531;&#12499;&#12522;&#21193;&#24375;&#12391;&#12418;&#12375;&#12424;&#12358;&#12363;&#12290;</abstract>
    </header>
    <body>
        <section>
            <title>Java&#39746;</title>
            <section>
                <title>final story</title>
                <section>
                    <title>&#23450;&#25968;&#12399;&#12356;&#12388;&#27770;&#12414;&#12427;?</title>
                    <p class="subsection">Java&#12398;&#23450;&#25968;&#12434;<em>&#34920;&#12375;&#12390;&#12356;&#12427;&#12424;&#12358;&#12394;</em>final&#12395;&#12388;&#12356;&#12390;&#20170;&#26085;&#12399;&#24489;&#32722;&#12375;&#12424;&#12358;&#12392;&#24605;&#12356;&#12414;&#12377;&#12290;</p>
                    <p class="subsection">&#12371;&#12398;final&#12392;&#12356;&#12358;&#12461;&#12540;&#12527;&#12540;&#12489;&#12399;&#21336;&#12395;&#23450;&#25968;&#12392;&#12399;&#12289;&#23569;&#12293;&#36949;&#12356;&#12381;&#12358;&#12391;&#12377;&#12290;&#12406;&#12387;&#12385;&#12419;&#12369;&#12289;&#12393;&#12435;&#12394;&#12473;&#12467;&#12540;&#12503;&#12391;
                        final&#12394;&#12398;&#12363;&#12289;&#25110;&#12356;&#12399;final&#12399;&#22793;&#25968;&#12398;&#12415;&#12395;&#12388;&#12369;&#12427;&#12431;&#12369;&#12376;&#12419;&#12394;&#12356;&#12398;&#12391;&#12289;&#23569;&#12293;&#35441;&#12375;&#12364;&#38627;&#12375;&#12356;&#12290;&#27425;&#12398;&#12477;&#12540;&#12473;&#12434;&#35211;&#12390;&#12367;&#12384;&#12373;&#12356;&#12290;</p>
                    <source xml:space="preserve"><![CDATA[
package oreilly.hcj.finalstory;

import java.awt.Color;

public class FinalReplacement {
	/** A string constant */
	public static final String A_STRING = "Java Hardcore";

	/** An int constant. */
	public static final int AN_INT = 5;

	/** A double constant. */
	public static final double A_DOUBLE = 102.55d;

	/** An array constant. */
	public static final int[] AN_ARRAY = new int[] { 1, 2, 3, 6, 9, 18, 36 };

	/** A color constant. */
	public static final Color A_COLOR = new Color(45, 0, 155);

	/** 
	 * A demonstration method.
	 */
	public void someMethod() {
		System.out.println(A_STRING);
		System.out.println(AN_INT);
		System.out.println(A_DOUBLE);
		System.out.println(AN_ARRAY);
		System.out.println(A_COLOR);
	}
}

                    ]]></source>
                    <p class="subsection">&#12414;&#12378;&#12399;&#12289;&#19978;&#35352;&#12398;&#12477;&#12540;&#12473;&#12391;5&#20491;&#12398;&#23450;&#25968;&#12434;&#23450;&#32681;&#12375;&#12390;&#12356;&#12414;&#12377;&#12364;&#12289;&#12371;&#12428;&#12434;&#12467;&#12531;&#12497;&#12452;&#12523;&#12377;&#12427;&#12392;&#12289;&#23455;&#38555;&#12395;&#12399;&#20197;&#19979;&#12398;&#12424;&#12358;&#12395;&#32622;&#12365;&#25563;&#12360;&#12425;&#12428;&#12414;&#12377;&#12290;</p>
                    <source xml:space="preserve"><![CDATA[
	public void someMethod() {
		System.out.println("Hardcore Java");
		System.out.println(5);
		System.out.println(102.55d);
		System.out.println(AN_ARRAY);
		System.out.println(A_COLOR);
	}
                    ]]></source>
                    <p class="subsection">&#12371;&#12371;&#12391;&#21839;&#38988;&#12394;&#12398;&#12399;&#12289;&#22793;&#25968;&#12398;&#22522;&#26412;&#22411;&#12392;String&#22411;&#12399;&#32622;&#12365;&#25563;&#12360;&#12425;&#12428;&#12390;&#12356;&#12427;&#12364;&#20182;&#12399;&#12381;&#12358;&#12391;&#12399;&#12394;&#12356;&#12289;&#12392;&#12356;&#12358;&#12371;&#12392;&#12391;&#12399;&#12394;&#12367;&#12289;&#20516;&#12364;&#12467;&#12531;&#12497;&#12452;&#12523;&#26178;&#12395; &#27770;&#23450;&#12377;&#12427;&#12392;&#12356;&#12358;&#12371;&#12392;&#12391;&#12377;&#12290;</p>
                    <p class="subsection">&#29305;&#12395;&#20170;&#22238;&#12398;&#19978;&#35352;&#12398;&#12477;&#12540;&#12473;&#12399;public&#12394;&#12398;&#12391;&#20182;&#12398;&#12463;&#12521;&#12473;&#12363;&#12425;&#20351;&#12431;&#12428;&#12427;&#21487;&#33021;&#24615;&#12364;&#12354;&#12426;&#12414;&#12377;&#12290;
                            &#12388;&#12414;&#12426;&#12289;&#20206;&#12395;&#19978;&#35352;&#12398;<code>A_STRING</code>&#12434;&#26360;&#12365;&#25563;&#12360;&#12390;&#12289;&#12467;&#12531;&#12497;&#12452;&#12523;&#12377;&#12428;&#12400;&#12289;&#30906;&#12363;&#12395;&#12381;&#12398;&#20013;&#12398;&#20516;&#12399;&#22793;&#12431;&#12426;&#12414;&#12377;&#12364;&#12289;&#20182;&#12398;&#12463;&#12521;&#12473;&#12391;
                            &#12381;&#12398;&#23450;&#25968;&#12434;&#21033;&#29992;&#12375;&#12390;&#12356;&#12427;&#22580;&#21512;&#12399;&#12289;&#12381;&#12398;&#20516;&#12414;&#12391;&#12399;&#22793;&#12431;&#12387;&#12390;&#12367;&#12428;&#12414;&#12379;&#12435;&#12290;&#12388;&#12414;&#12426;&#20182;&#12398;&#12463;&#12521;&#12473;&#12418;&#12467;&#12531;&#12497;&#12452;&#12523;&#12375;&#30452;&#12373;&#12394;&#12356;&#12392;<em>&#39364;&#30446;</em>&#12384;
                            &#12392;&#12356;&#12358;&#12371;&#12392;&#12391;&#12377;&#12290;<strong>&#12371;&#12428;&#12399;&#26178;&#12293;&#22823;&#12365;&#12394;&#12496;&#12464;&#12395;&#12394;&#12427;&#21487;&#33021;&#24615;&#12364;&#12354;&#12426;&#12414;&#12377;&#12290;</strong>
                    </p>
                </section>
                <section>
                    <title>&#12513;&#12477;&#12483;&#12489;&#12473;&#12467;&#12540;&#12503;&#12398;final&#22793;&#25968;</title>
                    <p class="subsection">&#12513;&#12477;&#12483;&#12489;&#12473;&#12467;&#12540;&#12503;&#12398;&#23450;&#25968;&#12392;&#12356;&#12358;&#12398;&#12399;&#12289;&#12420;&#12420;&#22855;&#12394;&#24863;&#12376;&#12364;&#12377;&#12427;&#12363;&#12418;&#12375;&#12428;&#12414;&#12379;&#12435;&#12364;&#12289;&#12371;&#12428;&#12364;&#32080;&#27083;&#24847;&#21619;&#12364;&#12354;&#12427;&#12398;&#12391;&#12377;&#12290;&#27425;&#12398;&#12477;&#12540;&#12473;&#12434;&#35211;&#12390;&#12367;&#12384;&#12373;&#12356;&#12290;</p>
                    <source xml:space="preserve"><![CDATA[

package oreilly.hcj.finalstory;

import javax.swing.JDialog;

public class FinalVariables {
	public static final void main(final String[] args) {
		System.out.println("Note how the key variable is changed.");
		someMethod("JAVA_HOME");
		someMethod("ANT_HOME");
	}

	public static String someBuggedMethod(final String environmentKey) {
		final String key = "env." + environmentKey;
		System.out.println("Key is: " + key);
		//key = new String("someValue"); // <= compiler error.  
		return (System.getProperty(key));
	}

	public static String someMethod(final String environmentKey) {
		final String key = "env." + environmentKey;
		System.out.println("Key is: " + key);
		return (System.getProperty(key));
	}

	public void buildGUIDialog(final String name) {
		final String instanceName;
		if (name == null) {
			// no problem here.
			instanceName = getClass()
				               .getName() + hashCode();
		} else {
			// no problem here as well.
			instanceName = getClass()
				               .getName() + name;
		}

		JDialog dialog = new JDialog();

		// .. Do a bunch of layout and component building. 
		dialog.setTitle(instanceName);

		// .. Do dialog assembly
		// instanceName = "hello";  // <= compiler error
	}
}


                    ]]></source>
                    <p class="subsection">&#19978;&#35352;&#12398;&#12477;&#12540;&#12473;&#12391;main&#12513;&#12477;&#12483;&#12489;&#12391;&#12399;&#12289;&#12418;&#12385;&#12429;&#12435;&#12289;&#12456;&#12521;&#12540;&#12399;&#36215;&#12371;&#12426;&#12414;&#12379;&#12435;&#12290;&#12473;&#12467;&#12540;&#12503;&#12364;&#12513;&#12477;&#12483;&#12489;&#12398;&#22580;&#21512;&#12399;
                        &#27598;&#22238;<code>final String key</code>&#12399;&#21021;&#26399;&#21270;&#12373;&#12428;&#12427;&#12398;&#12391;&#12289;&#12414;&#12427;&#12391;&#22793;&#25968;&#12398;&#12424;&#12358;&#12391;&#12377;&#12364;&#12289;&#23455;&#38555;&#12395;&#12399;&#12289;&#19978;&#35352;&#12398;<code>someBuggedMethod</code>&#12398;&#20013;&#12398;&#12289;
                        <code>//key = new String("someValue"); // compiler error.</code>&#12398;&#12467;&#12513;&#12531;&#12488;&#12434;&#12399;&#12378;&#12377;&#12392;&#12289;&#12467;&#12531;&#12497;&#12452;&#12523;&#12456;&#12521;&#12540;&#12364;&#36215;&#12371;&#12426;&#12414;&#12377;&#12290;&#12371;&#12428;&#12364;&#37325;&#35201;&#12391;&#12377;&#12290;
                        </p>
                        <p class="subsection">&#12388;&#12414;&#12426;&#12289;&#12467;&#12531;&#12497;&#12452;&#12523;&#12377;&#12427;&#12371;&#12392;&#12364;&#20986;&#26469;&#12427;&#12364;&#12289;&#24460;&#12395;&#12456;&#12521;&#12540;&#12395;&#12394;&#12427;&#21487;&#33021;&#24615;&#12398;&#12354;&#12427;&#12418;&#12398;(&#35542;&#29702;&#12456;&#12521;&#12540;)&#12364;&#19968;&#30058;&#21380;&#20171;&#12391;&#12289;&#12381;&#12398;&#21069;&#12395;&#12467;&#12531;&#12497;&#12452;&#12523;&#12456;&#12521;&#12540;&#12391;&#26908;&#20986;&#12375;&#12390;&#12375;&#12414;&#12360;&#12400;
                        &#12300;&#12354;&#12428;&#12289;&#12394;&#12435;&#12391;&#12384;&#12354;?&#12301;&#12392;&#12356;&#12358;&#20855;&#21512;&#12395;&#12377;&#12368;&#35211;&#12388;&#12363;&#12426;&#12414;&#12377;&#12290;&#12418;&#12375;&#12289;&#12467;&#12531;&#12497;&#12452;&#12523;&#12456;&#12521;&#12540;&#12395;&#12394;&#12425;&#12378;&#12289;&#25968;&#30334;&#12398;&#12463;&#12521;&#12473;&#12364;&#12391;&#12365;&#12354;&#12364;&#12387;&#12383;&#24460;&#12391;&#12289;&#12375;&#12363;&#12418;&#12289;&#12377;&#12391;&#12395;&#32013;&#21697;&#28168;&#12415;&#12395;&#12394;&#12387;&#12383;&#24460;&#12391;&#12456;&#12521;&#12540;&#12364;
                        &#36215;&#12371;&#12387;&#12383;&#22580;&#21512;&#12399;&#12289;&#30456;&#24403;&#12398;&#26178;&#38291;&#12364;&#12363;&#12363;&#12427;&#12371;&#12392;&#12395;&#12394;&#12426;&#12414;&#12377;&#12290;&#12377;&#12394;&#12431;&#12385;&#35542;&#29702;&#12456;&#12521;&#12540;&#12434;&#12394;&#12435;&#12392;&#12363;&#12467;&#12531;&#12497;&#12452;&#12523;&#12456;&#12521;&#12540;&#12395;&#20986;&#26469;&#12428;&#12400;&#12289;&#12415;&#12435;&#12394;&#24184;&#12379;&#12395;&#12394;&#12428;&#12427;&#12392;&#12356;&#12358;&#12371;&#12392;&#12391;&#12377;&#12290;</p>
                </section>
                <section>
                    <title>final&#12497;&#12521;&#12513;&#12540;&#12479;</title>
                    <p class="subsection">&#20197;&#21069;&#12289;eclipse&#12398;plugin&#12398;checkstyle&#12392;&#12356;&#12358;&#12467;&#12540;&#12487;&#12451;&#12531;&#12464;&#12398;&#12473;&#12479;&#12452;&#12523;&#12395;&#23550;&#12375;&#12390;&#12289;&#33394;&#12293;&#12356;&#12385;&#12419;&#12418;&#12435;&#12434;&#12388;&#12369;&#12427;&#12398;&#12391;&#12377;&#12364;&#12289;&#12381;&#12398;&#20013;&#12391;&#12418;&#12513;&#12477;&#12483;&#12489;&#12398;&#24341;&#25968;&#12395;final&#12434;
                        &#12388;&#12369;&#12390;&#12356;&#12394;&#12356;&#12392;&#12289;&#12377;&#12368;&#12395;warning&#12377;&#12427;&#12398;&#12391;&#12289;&#12300;&#12358;&#12387;&#12392;&#12358;&#12375;&#12356;&#12394;&#12354;&#12301;&#12392;&#12368;&#12425;&#12356;&#12395;&#24605;&#12387;&#12390;&#12356;&#12383;&#12371;&#12392;&#12364;&#12354;&#12426;&#12414;&#12375;&#12383;&#12290;&#12375;&#12363;&#12375;&#12289;&#12371;&#12428;&#12399;&#23455;&#38555;&#12388;&#12369;&#12427;&#12409;&#12365;&#12384;&#12392;&#12356;&#12358;&#12371;&#12392;&#12391;&#12377;&#12290;&#27425;&#12398;&#12477;&#12540;&#12473;&#12434;&#35211;&#12390;&#12367;&#12384;&#12373;&#12356;&#12290;</p>
                    <source xml:space="preserve"><![CDATA[

package oreilly.hcj.finalstory;

import java.beans.PropertyVetoException;
import java.beans.VetoableChangeSupport;
import java.beans.PropertyChangeSupport;

public class PersonTEST {
  private String name = null;
  Object object = new Object();
	VetoableChangeSupport vetoableChangeSupport = 
			new VetoableChangeSupport(object);
	PropertyChangeSupport propertyChangeSupport = 
			new PropertyChangeSupport(object);
	
  public void setName(String name) throws PropertyVetoException {
    String oldName = this.name;
    vetoableChangeSupport.fireVetoableChange("name", oldName, name);
    name = name;
    propertyChangeSupport.firePropertyChange("name", oldName, name);
  }
}



                    ]]></source>
                    <p class="subsection">&#12371;&#12371;&#12391;&#19968;&#12459;&#25152;&#38291;&#36949;&#12356;&#12364;&#12354;&#12426;&#12414;&#12377;&#12290;&#12393;&#12371;&#12363;&#12392;&#12356;&#12358;&#12392;<code>name = name;</code>&#12391;&#12377;&#12290;&#21336;&#12395;&#25509;&#38957;&#36766;this
                        &#12434;&#20184;&#12369;&#24536;&#12428;&#12383;&#12384;&#12369;&#12391;&#12377;&#12290;&#12371;&#12428;&#12391;&#12399;&#20195;&#20837;&#12364;&#34892;&#12431;&#12428;&#12414;&#12379;&#12435;&#12290;&#12418;&#12375;<code>setName(String name)</code>&#12364;<code>setName(final String name)</code>&#12392;&#12394;&#12387;&#12390;&#12356;&#12428;&#12400;&#12289;&#12381;&#12398;&#12511;&#12473;&#12399;&#12467;&#12531;&#12497;&#12452;&#12523;&#26178;&#12395;
                        &#12431;&#12363;&#12426;&#12414;&#12377;&#12290;&#23455;&#38555;eclipse&#12384;&#12387;&#12383;&#12425;&#12289;&#35430;&#12375;&#12390;&#12415;&#12427;&#12392;&#12289;final&#12364;&#12394;&#12356;&#12392;&#40644;&#33394;&#12398;warning&#12289;final&#12364;&#12354;&#12427;&#12392;&#36196;&#12356;&#12289;&#12356;&#12388;&#12418;&#12398;&#27874;&#32218;&#12364;
                        &#35211;&#12425;&#12428;&#12414;&#12377;&#12290;&#12388;&#12414;&#12426;&#12289;&#24341;&#25968;&#12395;&#12418;final&#12434;&#12388;&#12369;&#12427;&#12409;&#12365;&#12384;&#12392;&#12356;&#12358;&#12371;&#12392;&#12391;&#12375;&#12423;&#12358;&#12290;</p>
                </section>
            </section>
        </section>
    </body>
</document>