]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
8429dfd0036ca8ee114f02739370739b4c7f954a
[mirror_edk2.git] / Tools / Source / PcdTools / org / tianocore / pcd / entity / Token.java
1 /** @file
2 Token class.
3
4 This module contains all classes releted to PCD token.
5
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16 package org.tianocore.pcd.entity;
17
18 import java.math.BigInteger;
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23
24 import org.tianocore.pcd.entity.UsageIdentification;
25 import org.tianocore.pcd.exception.EntityException;
26
27 /**
28 This class is to descript a PCD token object. The information of a token mainly
29 comes from MSA, SPD and setting produced by platform developer.
30 **/
31 public class Token {
32 ///
33 /// Enumeration macro defintion for PCD type.
34 ///
35 public enum PCD_TYPE {FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODULE, DYNAMIC,
36 DYNAMIC_EX, UNKNOWN}
37
38 ///
39 /// Enumeration macro definition for datum type. All type mainly comes from ProcessBind.h.
40 /// Wizard maybe expand this type as "int, unsigned int, short, unsigned short etc" in
41 /// prompt dialog.
42 ///
43 public enum DATUM_TYPE {UINT8, UINT16, UINT32, UINT64, BOOLEAN, POINTER, UNKNOWN}
44
45 ///
46 /// Enumeration macor defintion for usage of PCD
47 ///
48 public enum PCD_USAGE {ALWAYS_PRODUCED, ALWAYS_CONSUMED, SOMETIMES_PRODUCED,
49 SOMETIMES_CONSUMED, UNKNOWN}
50
51 ///
52 /// cName is to identify a PCD entry and will be used for generating autogen.h/autogen.c.
53 /// cName will be defined in MSA, SPD and FPD, can be regarded as primary key with token space guid.
54 ///
55 public String cName;
56
57 ///
58 /// Token space name is the guid defined by token itself in package or module level. This
59 /// name mainly for DynamicEx type. For other PCD type token, his token space name is the
60 /// assignedtokenSpaceName as follows.
61 /// tokenSpaceName is defined in MSA, SPD, FPD, can be regarded as primary key with cName.
62 ///
63 public String tokenSpaceName;
64
65 ///
66 /// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in
67 /// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by
68 /// PCD run-time database autogen tools.
69 ///
70 public long tokenNumber;
71
72 ///
73 /// This token number is retrieved from FPD file for DynamicEx type.
74 ///
75 public long dynamicExTokenNumber;
76
77 ///
78 /// All supported PCD type, this value can be retrieved from SPD
79 /// Currently, only record all PCD type for this token in FPD file.
80 ///
81 public List<PCD_TYPE> supportedPcdType;
82
83 ///
84 /// If the token's item type is Dynamic or DynamicEx type, isDynamicPCD
85 /// is true.
86 ///
87 public boolean isDynamicPCD;
88
89 ///
90 /// datumSize is to descript the fix size or max size for this token.
91 /// datumSize is defined in SPD.
92 ///
93 public int datumSize;
94
95 ///
96 /// datum type is to descript what type can be expressed by a PCD token.
97 /// For same PCD used in different module, the datum type should be unique.
98 /// So it belong memeber to Token class.
99 ///
100 public DATUM_TYPE datumType;
101
102 ///
103 /// skuData contains all value for SkuNumber of token.
104 /// This field is for Dynamic or DynamicEx type PCD,
105 ///
106 public List<SkuInstance> skuData;
107
108 ///
109 /// consumers array record all module private information who consume this PCD token.
110 ///
111 public Map<String, UsageInstance> consumers;
112
113 /**
114 Constructure function for Token class
115
116 @param cName The name of token
117 @param tokenSpaceName The name of token space, it is a guid string
118 **/
119 public Token(String cName, String tokenSpaceName) {
120 this.cName = cName;
121 this.tokenSpaceName = tokenSpaceName;
122 this.tokenNumber = 0;
123 this.datumType = DATUM_TYPE.UNKNOWN;
124 this.datumSize = -1;
125 this.skuData = new ArrayList<SkuInstance>();
126
127 this.consumers = new HashMap<String, UsageInstance>();
128 this.supportedPcdType = new ArrayList<PCD_TYPE>();
129 }
130
131 /**
132 updateSupportPcdType
133
134 SupportPcdType should be gotten from SPD file actually, but now it just
135 record all PCD type for this token in FPD file.
136
137 @param pcdType new PCD type found in FPD file for this token.
138 **/
139 public void updateSupportPcdType(PCD_TYPE pcdType) {
140 for (int index = 0; index < this.supportedPcdType.size(); index ++) {
141 if (supportedPcdType.get(index) == pcdType) {
142 return;
143 }
144 }
145
146 //
147 // If not found, add the pcd type to member variable supportedPcdType
148 //
149 supportedPcdType.add(pcdType);
150 }
151
152 /**
153 Judge whether pcdType is belong to dynamic type. Dynamic type includes
154 DYNAMIC and DYNAMIC_EX.
155
156 @param pcdType the judged pcd type
157
158 @return boolean
159 */
160 public static boolean isDynamic(PCD_TYPE pcdType) {
161 if ((pcdType == PCD_TYPE.DYNAMIC ) ||
162 (pcdType == PCD_TYPE.DYNAMIC_EX)) {
163 return true;
164 }
165
166 return false;
167 }
168
169 public boolean isDynamicEx() {
170 for (int i = 0; i < supportedPcdType.size(); i++) {
171 if (supportedPcdType.get(i) == PCD_TYPE.DYNAMIC_EX) {
172 return true;
173 }
174 }
175
176 return false;
177 }
178
179 /**
180 Use "TokencName + "-" + SpaceTokenName" as primary key when adding token into database
181
182 @param cName Token name.
183 @param tokenSpaceName The token space guid string defined in MSA or SPD
184
185 @retval primary key for this token in token database.
186 **/
187 public static String getPrimaryKeyString(String cName, String tokenSpaceName) {
188 if (tokenSpaceName == null) {
189 return cName + "_nullTokenSpaceGuid";
190 } else {
191 return cName + "_" + tokenSpaceName.toString().replace('-', '_');
192 }
193 }
194
195 /**
196 If skudata list contains more than one data, then Sku mechanism is enable.
197
198 @retval boolean if the number of sku data exceed to 1
199 */
200 public boolean isSkuEnable() {
201 if (this.skuData.size() > 1) {
202 return true;
203 }
204 return false;
205 }
206
207 /**
208 If Hii type for value of token
209
210 @return boolean
211 **/
212 public boolean isHiiEnable() {
213 if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.HII_TYPE) {
214 return true;
215 }
216 return false;
217 }
218
219 /**
220 If Vpd type for value of token
221
222 @return boolean
223 **/
224 public boolean isVpdEnable() {
225 if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.VPD_TYPE) {
226 return true;
227 }
228 return false;
229 }
230
231 /**
232 Get the token primary key in token database.
233
234 @return String
235 */
236 public String getPrimaryKeyString () {
237 return Token.getPrimaryKeyString(cName, tokenSpaceName);
238 }
239
240 /**
241 Judge datumType is valid
242
243 @param type The datumType want to be judged.
244
245 @retval TRUE - The type is valid.
246 @retval FALSE - The type is invalid.
247 **/
248 public static boolean isValiddatumType(DATUM_TYPE type) {
249 if ((type.ordinal() < DATUM_TYPE.UINT8.ordinal() ) ||
250 (type.ordinal() > DATUM_TYPE.POINTER.ordinal())) {
251 return false;
252 }
253 return true;
254 }
255
256 /**
257 Judge pcdType is valid
258
259 @param type The PCdType want to be judged.
260
261 @retval TRUE - The type is valid.
262 @retval FALSE - The type is invalid.
263 **/
264 public static boolean isValidpcdType(PCD_TYPE type) {
265 if ((type.ordinal() < PCD_TYPE.FEATURE_FLAG.ordinal() ) ||
266 (type.ordinal() > PCD_TYPE.DYNAMIC_EX.ordinal())) {
267 return false;
268 }
269 return true;
270 }
271
272 /**
273 Add an usage instance for token
274
275 @param usageInstance The usage instance
276
277 @retval TRUE - Success to add usage instance.
278 @retval FALSE - Fail to add usage instance
279 **/
280 public boolean addUsageInstance(UsageInstance usageInstance) throws EntityException {
281 String exceptionStr;
282
283 if (isUsageInstanceExist(usageInstance.usageId)) {
284 exceptionStr = String.format("[PCD Collection Tool Exception] PCD %s for module %s has already exist in database, Please check all PCD build entries "+
285 "in modules %s in <ModuleSA> to make sure no duplicated definitions in FPD file!",
286 usageInstance.parentToken.cName,
287 usageInstance.usageId.moduleName,
288 usageInstance.usageId.moduleName);
289 throw new EntityException(exceptionStr);
290 }
291
292 //
293 // Put usage instance into usage instance database of this PCD token.
294 //
295 consumers.put(usageInstance.getPrimaryKey(), usageInstance);
296
297 return true;
298 }
299
300 /**
301 Judge whether exist an usage instance for this token
302
303 @param usageId The UsageInstance identification for usage instance
304
305 @return boolean whether exist an usage instance for this token.
306 */
307 public boolean isUsageInstanceExist(UsageIdentification usageId) {
308 String keyStr = UsageInstance.getPrimaryKey(usageId);
309
310 return (consumers.get(keyStr) != null);
311 }
312
313 /**
314 Get the PCD_TYPE according to the string of PCD_TYPE
315
316 @param pcdTypeStr The string of PCD_TYPE
317
318 @return PCD_TYPE
319 **/
320 public static PCD_TYPE getpcdTypeFromString(String pcdTypeStr) {
321 if (pcdTypeStr == null) {
322 return PCD_TYPE.UNKNOWN;
323 }
324
325 if (pcdTypeStr.equalsIgnoreCase("FEATURE_FLAG")) {
326 return PCD_TYPE.FEATURE_FLAG;
327 } else if (pcdTypeStr.equalsIgnoreCase("FIXED_AT_BUILD")) {
328 return PCD_TYPE.FIXED_AT_BUILD;
329 } else if (pcdTypeStr.equalsIgnoreCase("PATCHABLE_IN_MODULE")) {
330 return PCD_TYPE.PATCHABLE_IN_MODULE;
331 } else if (pcdTypeStr.equalsIgnoreCase("DYNAMIC")) {
332 return PCD_TYPE.DYNAMIC;
333 } else if (pcdTypeStr.equalsIgnoreCase("DYNAMIC_EX")) {
334 return PCD_TYPE.DYNAMIC_EX;
335 } else {
336 return PCD_TYPE.UNKNOWN;
337 }
338 }
339
340 /**
341 Get the string of given datumType. This string will be used for generating autogen files
342
343 @param datumType Given datumType
344
345 @return The string of datum type.
346 **/
347 public static String getStringOfdatumType(DATUM_TYPE datumType) {
348 switch (datumType) {
349 case UINT8:
350 return "UINT8";
351 case UINT16:
352 return "UINT16";
353 case UINT32:
354 return "UINT32";
355 case UINT64:
356 return "UINT64";
357 case POINTER:
358 return "POINTER";
359 case BOOLEAN:
360 return "BOOLEAN";
361 }
362 return "UNKNOWN";
363 }
364
365 /**
366 Get the datumType according to a string.
367
368 @param datumTypeStr The string of datumType
369
370 @return DATUM_TYPE
371 **/
372 public static DATUM_TYPE getdatumTypeFromString(String datumTypeStr) {
373 if (datumTypeStr.equalsIgnoreCase("UINT8")) {
374 return DATUM_TYPE.UINT8;
375 } else if (datumTypeStr.equalsIgnoreCase("UINT16")) {
376 return DATUM_TYPE.UINT16;
377 } else if (datumTypeStr.equalsIgnoreCase("UINT32")) {
378 return DATUM_TYPE.UINT32;
379 } else if (datumTypeStr.equalsIgnoreCase("UINT64")) {
380 return DATUM_TYPE.UINT64;
381 } else if (datumTypeStr.equalsIgnoreCase("VOID*")) {
382 return DATUM_TYPE.POINTER;
383 } else if (datumTypeStr.equalsIgnoreCase("BOOLEAN")) {
384 return DATUM_TYPE.BOOLEAN;
385 }
386 return DATUM_TYPE.UNKNOWN;
387 }
388
389 /**
390 Get string of given pcdType
391
392 @param pcdType The given PcdType
393
394 @return The string of PCD_TYPE.
395 **/
396 public static String getStringOfpcdType(PCD_TYPE pcdType) {
397 switch (pcdType) {
398 case FEATURE_FLAG:
399 return "FEATURE_FLAG";
400 case FIXED_AT_BUILD:
401 return "FIXED_AT_BUILD";
402 case PATCHABLE_IN_MODULE:
403 return "PATCHABLE_IN_MODULE";
404 case DYNAMIC:
405 return "DYNAMIC";
406 case DYNAMIC_EX:
407 return "DYNAMIC_EX";
408 }
409 return "UNKNOWN";
410 }
411
412 /**
413 Get the PCD_USAGE according to a string
414
415 @param usageStr The string of PCD_USAGE
416
417 @return The PCD_USAGE
418 **/
419 public static PCD_USAGE getUsageFromString(String usageStr) {
420 if (usageStr == null) {
421 return PCD_USAGE.UNKNOWN;
422 }
423
424 if (usageStr.equalsIgnoreCase("ALWAYS_PRODUCED")) {
425 return PCD_USAGE.ALWAYS_PRODUCED;
426 } else if (usageStr.equalsIgnoreCase("SOMETIMES_PRODUCED")) {
427 return PCD_USAGE.SOMETIMES_PRODUCED;
428 } else if (usageStr.equalsIgnoreCase("ALWAYS_CONSUMED")) {
429 return PCD_USAGE.ALWAYS_CONSUMED;
430 } else if (usageStr.equalsIgnoreCase("SOMETIMES_CONSUMED")) {
431 return PCD_USAGE.SOMETIMES_CONSUMED;
432 }
433
434 return PCD_USAGE.UNKNOWN;
435 }
436
437 /**
438 Get the string of given PCD_USAGE
439
440 @param usage The given PCD_USAGE
441
442 @return The string of PDC_USAGE.
443 **/
444 public static String getStringOfUsage(PCD_USAGE usage) {
445 switch (usage) {
446 case ALWAYS_PRODUCED:
447 return "ALWAYS_PRODUCED";
448 case ALWAYS_CONSUMED:
449 return "ALWAYS_CONSUMED";
450 case SOMETIMES_PRODUCED:
451 return "SOMETIMES_PRODUCED";
452 case SOMETIMES_CONSUMED:
453 return "SOMETIMES_CONSUMED";
454 }
455 return "UNKNOWN";
456 }
457
458 /**
459 Get the Defined datumType string for autogen. The string is for generating some MACROs in Autogen.h
460
461 @param datumType The given datumType
462
463 @return string of datum type for autogen.
464 **/
465 public static String GetAutogenDefinedatumTypeString(DATUM_TYPE datumType) {
466 switch (datumType) {
467
468 case UINT8:
469 return "8";
470 case UINT16:
471 return "16";
472 case BOOLEAN:
473 return "BOOL";
474 case POINTER:
475 return "PTR";
476 case UINT32:
477 return "32";
478 case UINT64:
479 return "64";
480 default:
481 return null;
482 }
483 }
484
485 /**
486 Get the datumType String for Autogen. This string will be used for generating defintions of PCD token in autogen
487
488 @param datumType The given datumType
489
490 @return string of datum type.
491 **/
492
493 public static String getAutogendatumTypeString(DATUM_TYPE datumType) {
494 switch (datumType) {
495 case UINT8:
496 return "UINT8";
497 case UINT16:
498 return "UINT16";
499 case UINT32:
500 return "UINT32";
501 case UINT64:
502 return "UINT64";
503 case POINTER:
504 return "VOID*";
505 case BOOLEAN:
506 return "BOOLEAN";
507 }
508 return null;
509 }
510
511 /**
512 Get the datumType string for generating some MACROs in autogen file of Library
513
514 @param datumType The given datumType
515
516 @return String of datum for genrating bit charater.
517 **/
518 public static String getAutogenLibrarydatumTypeString(DATUM_TYPE datumType) {
519 switch (datumType) {
520 case UINT8:
521 return "8";
522 case UINT16:
523 return "16";
524 case BOOLEAN:
525 return "Bool";
526 case POINTER:
527 return "Ptr";
528 case UINT32:
529 return "32";
530 case UINT64:
531 return "64";
532 default:
533 return null;
534 }
535 }
536
537 /**
538 Get the sku data who id is 0.
539
540 @retval DynamicTokenValue the value of this dyanmic token.
541 **/
542 public DynamicTokenValue getDefaultSku() {
543 int index;
544
545 for (index = 0; index < this.skuData.size(); index ++) {
546 if (skuData.get(index).id == 0) {
547 return skuData.get(index).value;
548 }
549 }
550
551 return null;
552 }
553
554 /**
555 Get the number of Sku data for this token
556
557 @retval int the number of sku data
558 **/
559 public int getSkuIdCount () {
560 return this.skuData.size();
561 }
562
563 /**
564 Get the size of PCD value, this PCD is POINTER type.
565
566 @param str the string of the value
567 @param al
568 **/
569 private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {
570 if (isValidNullValue(str)) {
571 al.add(new Integer(0));
572 } else {
573 //
574 // isValidNullValue has already make sure that str here
575 // always contain a valid default value of the following 3
576 // cases:
577 // 1) "Hello world" //Assci string
578 // 2) L"Hello" //Unicode string
579 // 3) {0x01, 0x02, 0x03} //Byte stream
580 //
581 if (str.startsWith("\"")) {
582 al.add(new Integer(str.length() - 2));
583 } else if (str.startsWith("L\"")){
584 //
585 // Unicode is 2 bytes each.
586 //
587 al.add(new Integer((str.length() - 3) * 2));
588 } else if (str.startsWith("{")) {
589 //
590 // We count the number of "," in the string.
591 // The number of byte is one plus the number of
592 // comma.
593 //
594 String str2 = str;
595
596 int cnt = 0;
597 int pos = 0;
598 pos = str2.indexOf(",", 0);
599 while (pos != -1) {
600 cnt++;
601 pos++;
602 pos = str2.indexOf(",", pos);
603 }
604 cnt++;
605 al.add(new Integer(cnt));
606 }
607 }
608 }
609
610 /**
611 This method can be used to get the MAX and current size
612 for pointer type dynamic(ex) PCD entry
613 **/
614 public ArrayList<Integer> getPointerTypeSize () {
615 ArrayList<Integer> al = new ArrayList<Integer>();
616
617 //
618 // For VPD_enabled and HII_enabled, we can only return the MAX size.
619 // For the default DATA type dynamic PCD entry, we will return
620 // the MAX size and current size for each SKU_ID.
621 //
622 al.add(new Integer(this.datumSize));
623
624 if (!this.isVpdEnable()) {
625 int idx;
626 if (this.isHiiEnable()){
627 for (idx = 0; idx < this.skuData.size(); idx++) {
628 String str = this.skuData.get(idx).value.hiiDefaultValue;
629 getCurrentSizeFromDefaultValue(str, al);
630 }
631 } else {
632 for (idx = 0; idx < this.skuData.size(); idx++) {
633 String str = this.skuData.get(idx).value.value;
634 getCurrentSizeFromDefaultValue(str, al);
635 }
636 }
637 }
638
639 return al;
640 }
641
642 /**
643 Get default value for a token, For HII type, HiiDefaultValue of default
644 SKU 0 will be returned; For Default type, the defaultvalue of default SKU
645 0 will be returned.
646
647 @return String
648 */
649 public String getDynamicDefaultValue() {
650 DynamicTokenValue dynamicData = getDefaultSku();
651 if (hasDefaultValue()) {
652 switch (dynamicData.type) {
653 case DEFAULT_TYPE:
654 return dynamicData.value;
655 }
656 }
657
658 return null;
659 }
660
661 //
662 // BugBug: We need change this algorithm accordingly when schema is updated
663 // to support no default value.
664 //
665 public boolean hasDefaultValue () {
666 DynamicTokenValue dynamicValue = null;
667
668 if (isSkuEnable()) {
669 return true;
670 }
671
672 if (this.isDynamicPCD) {
673 dynamicValue = getDefaultSku();
674 switch (dynamicValue.type) {
675 case HII_TYPE:
676 return true;
677 case VPD_TYPE:
678 return true;
679 case DEFAULT_TYPE:
680 return !isValidNullValue(dynamicValue.value);
681 }
682 }
683
684 return false;
685 }
686
687 /**
688 Judge the value is NULL value. NULL value means the value is uninitialized value
689
690 @param judgedValue
691
692 @return boolean
693 */
694 public boolean isValidNullValue(String judgedValue) {
695 String subStr;
696 BigInteger bigIntValue;
697
698 switch (datumType) {
699 case UINT8:
700 case UINT16:
701 case UINT32:
702 if (judgedValue.length() > 2) {
703 if ((judgedValue.charAt(0) == '0') &&
704 ((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){
705 subStr = judgedValue.substring(2, judgedValue.length());
706 bigIntValue = new BigInteger(subStr, 16);
707 } else {
708 bigIntValue = new BigInteger(judgedValue);
709 }
710 } else {
711 bigIntValue = new BigInteger(judgedValue);
712 }
713 if (bigIntValue.bitCount() == 0) {
714 return true;
715 }
716 break;
717 case UINT64:
718 if (judgedValue.length() > 2){
719 if ((judgedValue.charAt(0) == '0') &&
720 ((judgedValue.charAt(1) == 'x') ||
721 (judgedValue.charAt(1) == 'X'))) {
722 bigIntValue = new BigInteger(judgedValue.substring(2, judgedValue.length()), 16);
723 if (bigIntValue.bitCount() == 0) {
724 return true;
725 }
726 } else {
727 bigIntValue = new BigInteger(judgedValue);
728 if (bigIntValue.bitCount() == 0) {
729 return true;
730 }
731 }
732 } else {
733 bigIntValue = new BigInteger(judgedValue);
734 if (bigIntValue.bitCount() == 0) {
735 return true;
736 }
737 }
738 break;
739 case BOOLEAN:
740 if (judgedValue.equalsIgnoreCase("false")) {
741 return true;
742 }
743 break;
744 case POINTER:
745 if (judgedValue.equalsIgnoreCase("") ||
746 judgedValue.equalsIgnoreCase("\"\"") ||
747 judgedValue.equalsIgnoreCase("L\"\"") ||
748 (judgedValue.length() == 0) ||
749 judgedValue.equalsIgnoreCase("{0}")) {
750 return true;
751 }
752 }
753 return false;
754 }
755
756 /**
757 Is the string value in Unicode
758
759 @return boolean
760 **/
761 public boolean isHiiDefaultValueUnicodeStringType() {
762 DynamicTokenValue dynamicData = getDefaultSku();
763
764 if (dynamicData == null)
765 return false;
766
767 return dynamicData.hiiDefaultValue.startsWith("L\"")
768 && dynamicData.hiiDefaultValue.endsWith("\"");
769 }
770
771 /**
772 Is the string value in ANSCI
773
774 @return boolean
775 **/
776 public boolean isHiiDefaultValueASCIIStringType() {
777 DynamicTokenValue dynamicData = getDefaultSku();
778
779 if (dynamicData == null)
780 return false;
781
782 return dynamicData.hiiDefaultValue.startsWith("\"")
783 && dynamicData.hiiDefaultValue.endsWith("\"");
784 }
785
786 /**
787 Judege whether current value is UNICODE string type.
788 @return boolean
789 */
790 public boolean isUnicodeStringType () {
791 String str = getDynamicDefaultValue();
792
793 if (str == null) {
794 return false;
795 }
796
797 if (datumType == Token.DATUM_TYPE.POINTER &&
798 str.startsWith("L\"") &&
799 str.endsWith("\"")) {
800 return true;
801 }
802
803 return false;
804 }
805
806 public boolean isASCIIStringType () {
807 String str = getDynamicDefaultValue();
808
809 if (str == null) {
810 return false;
811 }
812
813 if (datumType == Token.DATUM_TYPE.POINTER &&
814 str.startsWith("\"") &&
815 str.endsWith("\"")) {
816 return true;
817 }
818
819 return false;
820 }
821
822 public boolean isByteStreamType () {
823 String str = getDynamicDefaultValue();
824
825 if (str == null) {
826 return false;
827 }
828
829 if (datumType == Token.DATUM_TYPE.POINTER &&
830 str.startsWith("{") &&
831 str.endsWith("}")) {
832 return true;
833 }
834
835 return false;
836
837 }
838
839 public String getStringTypeString () {
840 return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);
841 }
842 }
843
844
845
846