Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / io / ObjectStreamField.js
1 Clazz.load(null,"java.io.ObjectStreamField",["java.lang.Boolean","$.Byte","$.Character","$.Double","$.Float","$.Long","$.NullPointerException","$.Short","java.util.Arrays"],function(){
2 c$=Clazz.decorateAsClass(function(){
3 this.name=null;
4 this.type=null;
5 this.offset=0;
6 this.typeString=null;
7 this.unshared=false;
8 this.isDeserialized=false;
9 Clazz.instantialize(this,arguments);
10 },java.io,"ObjectStreamField",null,Comparable);
11 Clazz.makeConstructor(c$,
12 function(name,cl){
13 if(name==null||cl==null){
14 throw new NullPointerException();
15 }this.name=name;
16 this.type=cl;
17 },"~S,Class");
18 Clazz.makeConstructor(c$,
19 function(name,cl,unshared){
20 if(name==null||cl==null){
21 throw new NullPointerException();
22 }this.name=name;
23 this.type=cl;
24 this.unshared=unshared;
25 },"~S,Class,~B");
26 Clazz.makeConstructor(c$,
27 function(signature,name){
28 if(name==null){
29 throw new NullPointerException();
30 }this.name=name;
31 this.typeString=signature.$replace('.', '/');
32 this.isDeserialized=true;
33 },"~S,~S");
34 Clazz.overrideMethod(c$,"compareTo",
35 function(o){
36 var f=o;
37 var thisPrimitive=this.isPrimitive();
38 var fPrimitive=f.isPrimitive();
39 if(thisPrimitive!=fPrimitive){
40 return thisPrimitive?-1:1;
41 }return this.getName().compareTo(f.getName());
42 },"~O");
43 Clazz.overrideMethod(c$,"equals",
44 function(arg0){
45 return this.compareTo(arg0)==0;
46 },"~O");
47 Clazz.overrideMethod(c$,"hashCode",
48 function(){
49 return this.getName().hashCode();
50 });
51 Clazz.defineMethod(c$,"getName",
52 function(){
53 return this.name;
54 });
55 Clazz.defineMethod(c$,"getOffset",
56 function(){
57 return this.offset;
58 });
59 Clazz.defineMethod(c$,"getTypeInternal",
60 ($fz=function(){
61 return this.type;
62 },$fz.isPrivate=true,$fz));
63 Clazz.defineMethod(c$,"getType",
64 function(){
65 var cl=this.getTypeInternal();
66 if(this.isDeserialized&&!cl.isPrimitive()){
67 return Clazz._O;
68 }return cl;
69 });
70 Clazz.defineMethod(c$,"getTypeCode",
71 function(){
72 var t=this.getTypeInternal();
73 if(t===Integer.TYPE){
74 return'I';
75 }if(t===Byte.TYPE){
76 return'B';
77 }if(t===Character.TYPE){
78 return'C';
79 }if(t===Short.TYPE){
80 return'S';
81 }if(t===Boolean.TYPE){
82 return'Z';
83 }if(t===Long.TYPE){
84 return'J';
85 }if(t===Float.TYPE){
86 return'F';
87 }if(t===Double.TYPE){
88 return'D';
89 }if(t.isArray()){
90 return'[';
91 }return'L';
92 });
93 Clazz.defineMethod(c$,"getTypeString",
94 function(){
95 if(this.isPrimitive()){
96 return null;
97 }if(this.typeString==null){
98 var t=this.getTypeInternal();
99 var typeName=t.getName().$replace('.', '/');
100 var str=(t.isArray())?typeName:("L"+typeName+';');
101 this.typeString=str.intern();
102 }return this.typeString;
103 });
104 Clazz.defineMethod(c$,"isPrimitive",
105 function(){
106 var t=this.getTypeInternal();
107 return t!=null&&t.isPrimitive();
108 });
109 Clazz.defineMethod(c$,"setOffset",
110 function(newValue){
111 this.offset=newValue;
112 },"~N");
113 Clazz.overrideMethod(c$,"toString",
114 function(){
115 return this.getClass().getName()+'(' + this.getName () + ':' + this.getTypeInternal () + ')';
116 });
117 c$.sortFields=Clazz.defineMethod(c$,"sortFields",
118 function(fields){
119 if(fields.length>1){
120 var fieldDescComparator=((Clazz.isClassDefined("java.io.ObjectStreamField$1")?0:java.io.ObjectStreamField.$ObjectStreamField$1$()),Clazz.innerTypeInstance(java.io.ObjectStreamField$1,this,null));
121 java.util.Arrays.sort(fields,fieldDescComparator);
122 }},"~A");
123 Clazz.defineMethod(c$,"resolve",
124 function(loader){
125 if(this.typeString.length==1){
126 switch(this.typeString.charAt(0)){
127 case'I':
128 this.type=Integer.TYPE;
129 return;
130 case'B':
131 this.type=Byte.TYPE;
132 return;
133 case'C':
134 this.type=Character.TYPE;
135 return;
136 case'S':
137 this.type=Short.TYPE;
138 return;
139 case'Z':
140 this.type=Boolean.TYPE;
141 return;
142 case'J':
143 this.type=Long.TYPE;
144 return;
145 case'F':
146 this.type=Float.TYPE;
147 return;
148 case'D':
149 this.type=Double.TYPE;
150 return;
151 }
152 }var className=this.typeString.$replace('/', '.');
153 if((className.charAt(0)).charCodeAt(0)==('L').charCodeAt(0)){
154 className=className.substring(1,className.length-1);
155 }try{
156 var cl=Clazz._4Name(className,false,loader);
157 this.type=cl;
158 }catch(e){
159 if(Clazz.instanceOf(e,ClassNotFoundException)){
160 }else{
161 throw e;
162 }
163 }
164 },"ClassLoader");
165 Clazz.defineMethod(c$,"isUnshared",
166 function(){
167 return this.unshared;
168 });
169 c$.$ObjectStreamField$1$=function(){
170 Clazz.pu$h(self.c$);
171 c$=Clazz.declareAnonymous(java.io,"ObjectStreamField$1",null,java.util.Comparator);
172 Clazz.overrideMethod(c$,"compare",
173 function(f1,f2){
174 return f1.compareTo(f2);
175 },"java.io.ObjectStreamField,java.io.ObjectStreamField");
176 c$=Clazz.p0p();
177 };
178 });