KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > vladium > jcd > cls > attribute > SyntheticAttribute_info


1 /* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved.
2  *
3  * This program and the accompanying materials are made available under
4  * the terms of the Common Public License v1.0 which accompanies this distribution,
5  * and is available at http://www.eclipse.org/legal/cpl-v10.html
6  *
7  * $Id: SyntheticAttribute_info.java,v 1.1.1.1.2.1 2004/07/10 03:34:52 vlad_r Exp $
8  */

9 package com.vladium.jcd.cls.attribute;
10
11 import java.io.IOException JavaDoc;
12
13 import com.vladium.jcd.lib.UDataOutputStream;
14
15 // ----------------------------------------------------------------------------
16
/**
17  * The Synthetic attribute is a fixed-length attribute in the attributes table
18  * of ClassFile, {@link com.vladium.jcd.cls.Field_info}, and
19  * {@link com.vladium.jcd.cls.Method_info} structures. A class member that does
20  * not appear in the source code must be marked using a Synthetic attribute.<P>
21  *
22  * The Synthetic attribute has the following format:
23  * <PRE>
24  * Synthetic_attribute {
25  * u2 attribute_name_index;
26  * u4 attribute_length;
27  * }
28  * </PRE>
29  *
30  * The value of the attribute_name_index item must be a valid index into the
31  * constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info
32  * structure representing the string "Synthetic".<P>
33  *
34  * The value of the attribute_length item is zero.
35  *
36  * @author (C) 2001, Vlad Roubtsov
37  */

38 public
39 final class SyntheticAttribute_info extends Attribute_info
40 {
41     // public: ................................................................
42

43     
44     public SyntheticAttribute_info (final int attribute_name_index)
45     {
46         super (attribute_name_index, 0);
47     }
48     
49     
50     public long length ()
51     {
52         return 6;
53     }
54     
55     // Visitor:
56

57     public void accept (final IAttributeVisitor visitor, final Object JavaDoc ctx)
58     {
59         visitor.visit (this, ctx);
60     }
61     
62     public String JavaDoc toString ()
63     {
64         return "SyntheticValueAttribute_info: [attribute_name_index = " + m_name_index + ", attribute_length = " + m_attribute_length + ']';
65     }
66     
67     // Cloneable:
68

69     /**
70      * Performs a deep copy.
71      */

72     public Object JavaDoc clone ()
73     {
74         return super.clone ();
75     }
76        
77     // IClassFormatOutput:
78

79     public void writeInClassFormat (final UDataOutputStream out) throws IOException JavaDoc
80     {
81         super.writeInClassFormat (out);
82     }
83     
84     // protected: .............................................................
85

86     // package: ...............................................................
87

88
89     SyntheticAttribute_info (final int attribute_name_index, final long attribute_length)
90     {
91         super (attribute_name_index, attribute_length);
92     }
93     
94     // private: ...............................................................
95

96 } // end of class
97
// ----------------------------------------------------------------------------
98

99
Popular Tags