public class longchar extends Text implements LargeObject
Although Progress documentation states that the default value of any longchar
variable is the unknown value, the real behavior is that it gets initialized to the empty
string, same as character variables get initialized.
BaseDataType.Type, BaseDataType.WrapperHandler
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
codePage
Variable to store code page value set by FIX-CODEPAGE statement.
|
private boolean |
fixedCodepage
Variable to store if code page value was set by FIX-CODEPAGE statement.
|
Constructor and Description |
---|
longchar()
Default constructor, creates an instance that represents the unknown value.
|
longchar(BaseDataType value)
This is a special c'tor which should be used only when converting the
value returned by a function or method with polymorphic return type into the
expected type (i.e.
|
longchar(char ch)
Constructs an instance that has a
char value passed
in and which does not represent the unknown value . |
longchar(java.lang.String value)
Constructs an instance that has the
String value passed
in and which does not represent the unknown value ,
unless the value argument is null . |
longchar(java.lang.String value,
boolean caseSens)
Constructs an instance that has the
String value passed
in and which does not represent the unknown value
unless the value argument is null . |
longchar(Text value)
Create a new instance, by copying the state of the passed
Text . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
_getCodePage()
Returns the code page of a the current longchar variable.
|
byte[] |
asByteArray(long pos,
long len)
Return the entire contents of the current buffer as an array.
|
void |
assign(longchar value)
Assigns the value represented by
value to this object. |
void |
assign(Text value)
Sets the state (data and unknown value) of this instance based on the state of the passed
instance.
|
int |
compareTo(java.lang.Object obj)
Compares this instance with the specified instance and returns a -1
if this instance is less than the specified, 0 if the two instances
are equal and 1 if this instance is greater than the specified
instance.
|
java.lang.String |
defaultFormatString()
Return the default display format string for this type.
|
BaseDataType |
duplicate()
Does the same as standard
clone() method but returns an
instance of BaseDataType and doesn't throw the
CloneNotSupportedException . |
static void |
fixCodePage(BaseDataType value,
BaseDataType cpToUse)
Implements Progress 4GL feature for FIX-CODEPAGE statement.
|
static void |
fixCodePage(BaseDataType value,
java.lang.String cpToUse)
Implements Progress 4GL feature for FIX-CODEPAGE statement.
|
void |
fixCodePage(character cpToUse)
Implements Progress 4GL feature for FIX-CODEPAGE statement.
|
static longchar |
fixCodePage(longchar longcharRef,
java.lang.String cpToUse)
Implements Progress 4GL feature for FIX-CODEPAGE statement.
|
static longchar |
fixCodePage(longchar longcharRef,
java.lang.String cpToUse,
boolean prepareClob)
Implements Progress 4GL feature for FIX-CODEPAGE statement.
|
static void |
fixCodePage(longchar longcharRef,
Text cpToUse)
Implements Progress 4GL feature for FIX-CODEPAGE statement.
|
void |
fixCodePage(java.lang.String cpToUse)
Implements Progress 4GL feature for FIX-CODEPAGE statement.
|
character |
getCodePage()
Returns the code page of a the current longchar variable.
|
static character |
getCodePage(BaseDataType value)
Returns the code page of a the specified longchar variable.
|
static character |
getCodePage(longchar value)
Returns the code page of a the specified longchar variable.
|
int |
getSize()
Obtain the length (in bytes) of this BDT will use when serialized.
|
BaseDataType.Type |
getType()
Get the type
|
BaseDataType |
instantiateDefault()
Creates a new instance of the same type that represents the
default initialized value.
|
protected BaseDataType |
instantiateDefaultExtent()
Get the default initialization for an extent variable of this type.
|
BaseDataType |
instantiateUnknown()
Creates a new instance of the same type that represents the
unknown value . |
boolean |
isCharacterData()
Indicate whether this object manages character data (as opposed to binary data).
|
boolean |
isCodePageFixed()
Return the value codepage fixed status.
|
static logical |
isCodePageFixed(longchar value)
Return
true if the codepage of the given longchar variable is fixed. |
boolean |
isEmbeddedNullAllowed()
Report if existing instances that have embedded null characters are allowed to be
assigned to this instance.
|
protected boolean |
isIncompatibleTypesOnConversion(BaseDataType value)
Assigns the value represented by
value to this object. |
long |
lengthOf()
The length of the data managed by this object.
|
java.lang.String |
toString(java.lang.String fmt)
Creates a string representation of the instance data using the user- specified Progress 4GL format
string.
|
java.lang.String |
toStringExport()
Creates a string representation of the instance data using the 'export'
format.
|
java.lang.String |
toStringMessage()
Creates a string representation of the instance data in a form that is compatible with the
MESSAGE language statement. |
void |
write(boolean overlay,
java.lang.String data,
int offset,
boolean trim)
Write the given character data into the data managed by this object, overwriting the data
that are at the given location, if any.
|
assign, assign, assign, assign, assign, caseSensitiveHashCode, deepAssign, equalsCaseSensitively, getValue, hashCode, isCaseSensitive, isUnknown, javaSpacifyNull, javaTruncateNull, maximum, minimum, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, progressSpacifyNull, readChar, readExternal, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, replaceEntry, setCaseSensitive, setCaseSensitive, setTemporaryCaseSensitive, setUnknown, setValue, toJavaType, writeExternal
assign, assign, calcFormatLength, createProxy, createProxy, deepCopy, elementsOfType, equals, fallback, formatLength, fromTypeName, generateDefault, generateUnknown, getAssigner, getTypeName, incompatibleTypesOnConversion, initialize, initializeDefaultExtent, invalidInitializer, isAllKnown, isAllKnown, isAssignDirect, isProxy, isUnknownValue, maximum, minimum, notUnknownValue, sameType, val, variable
changed, checkUndoable, checkUndoable, checkUndoable, getTransLevel, isGlobal, isUndoable, markUndoable, popBlock, rollback, setGlobal
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
binaryEquals, getFieldReference, isUnknown, readBytes, readChars, setFieldReference, write
private java.lang.String codePage
private boolean fixedCodepage
public longchar()
public longchar(BaseDataType value)
Only Text (character or longchar) BDT's can be converted to longchar.
value
- The value to be used for this instance.public longchar(java.lang.String value)
String
value passed
in and which does not represent the unknown value
,
unless the value
argument is null
.
If value is not "" then codepage is cpinternalvalue
- The character value of the resulting instance.public longchar(java.lang.String value, boolean caseSens)
String
value passed
in and which does not represent the unknown value
unless the value
argument is null
.value
- The character value of the resulting instance.caseSens
- Specifies whether this instance should use case sensitive
comparisons.public longchar(char ch)
char
value passed
in and which does not represent the unknown value
.ch
- The character value of the resulting instance.public BaseDataType.Type getType()
getType
in class BaseDataType
public boolean isEmbeddedNullAllowed()
isEmbeddedNullAllowed
in class Text
false
.public int compareTo(java.lang.Object obj)
Comparable
interface.public static character getCodePage(longchar value)
value
- The value for which the codepage will be retrieved.public static character getCodePage(BaseDataType value)
value
- The value for which the codepage will be retrieved.public character getCodePage()
public java.lang.String _getCodePage()
This is the String returning value, the unknown value is represented by null
.
_getCodePage
in interface LargeObject
public BaseDataType instantiateUnknown()
unknown value
.instantiateUnknown
in class Text
unknown value
.public static logical isCodePageFixed(longchar value)
true
if the codepage of the given longchar variable is fixed.value
- The value for which the codepage will be retrieved.public static longchar fixCodePage(longchar longcharRef, java.lang.String cpToUse)
longcharRef
- A reference to a longchar
variable.cpToUse
- The new value for codepage to be fixed.public static longchar fixCodePage(longchar longcharRef, java.lang.String cpToUse, boolean prepareClob)
Note: actually this method should be as less visible as possible, preferably private. However, it must
be accessed from FieldReference
.
longcharRef
- A reference to a longchar
variable.cpToUse
- The new value for codepage to be fixed. If prepareClob
is true, this parameter must NOT
be null
.prepareClob
- Allow to set a FIXED the CODEPAGE on target longcharRef
only if it is a field (hence
a clob
) only when this parameter is true
. Otherwise the procedure is finished.
At least this is behaviour in 4GL: ERROR-STATUS:ERROR = YES ERROR-STATUS:GET-NUMBER(1) = 0.
ERROR-STATUS:get-message(1) = "".public static void fixCodePage(longchar longcharRef, Text cpToUse)
longcharRef
- A reference to a longchar
variable.cpToUse
- The new value for codepage to be fixed.public static void fixCodePage(BaseDataType value, java.lang.String cpToUse)
value
- A reference to a BDT, obtained by dereferenciation.cpToUse
- The new value for codepage to be fixed.public static void fixCodePage(BaseDataType value, BaseDataType cpToUse)
value
- A reference to a BDT, obtained by dereferenciation.cpToUse
- The new value for codepage to be fixed.public void fixCodePage(java.lang.String cpToUse)
cpToUse
- The new value for codepage to be fixed.public void fixCodePage(character cpToUse)
cpToUse
- The new value for codepage to be fixed.public boolean isCodePageFixed()
TRUE
is codepage was fixed for this variable,
FALSE
otherwise.public java.lang.String defaultFormatString()
defaultFormatString
in class BaseDataType
public BaseDataType duplicate()
clone()
method but returns an
instance of BaseDataType
and doesn't throw the
CloneNotSupportedException
.duplicate
in class BaseDataType
public java.lang.String toStringMessage()
MESSAGE
language statement. If the instance represents the unknown value
, a '?' will
be returned.toStringMessage
in interface LargeObject
toStringMessage
in class BaseDataType
public java.lang.String toStringExport()
unknown value
, a '?' will be returned. Any instances of
double quotes inside the string will be doubled up on output.toStringExport
in class BaseDataType
public java.lang.String toString(java.lang.String fmt)
longchar
is basically the same as for any character
.toString
in class BaseDataType
fmt
- The Progress 4GL format string for a character data type.public boolean isCharacterData()
isCharacterData
in interface LargeObject
true
.public long lengthOf()
lengthOf
in interface LargeObject
public byte[] asByteArray(long pos, long len)
asByteArray
in interface LargeObject
pos
- Starting offset position.len
- Length of range to return.unknown
or has an
undefined size, then null
will be returned.public void write(boolean overlay, java.lang.String data, int offset, boolean trim)
This implementation:
trim
option (i.e., any existing characters beyond the end of the
write are left in place, regardless of the value of trim
);write
in interface LargeObject
overlay
- Flag indicating if the OVERLAY option is used.data
- Data to be assigned to this object.offset
- Offset position (in characters) in the target large object.trim
- true
to truncate any remaining data in the target large object; false
to leave remaining data alone. Ignored.public BaseDataType instantiateDefault()
instantiateDefault
in class BaseDataType
protected BaseDataType instantiateDefaultExtent()
instantiateDefaultExtent
in class BaseDataType
protected boolean isIncompatibleTypesOnConversion(BaseDataType value)
value
to this object. If this longchar
does not have a
fixed codepage, the default codepage (SESSION:CPINTERNAL) is used. Otherwise a codepage conversion
occurs.isIncompatibleTypesOnConversion
in class Text
value
- The source Text
to be assigned.public void assign(Text value)
Text
This form of assignment allows embedded null characters to be assigned from one already existing instance to another if the child class allows it.
public void assign(longchar value)
value
to this object. If this longchar
does not have a
fixed codepage, the codepage from the source is copied too. Otherwise a codepage conversion occurs.value
- The source longchar
to be assigned.public int getSize()
getSize
in class BaseDataType