Class: TextFormatBean

bean.base. TextFormatBean

TextFormatBean gives information about the restrictions on a text value


new TextFormatBean( [json])

Parameters:
Name Type Argument Description
json object <optional>

The json to build this object from, if none supplied, default json will be created

Extends

Methods


clone()

Return a copy of this structure

Inherited From:

getAgencyId()

Returns the Id of the Agency who is responsible for maintaining this structure

Inherited From:
Returns:

The Agency Id

Type
string

getClassType( [bean])

Get the name of the class of this object

Parameters:
Name Type Argument Default Description
bean boolean <optional>
false

If true, the word "bean" will be omitted

Inherited From:
Throws:

If the first argument is supplied but not a boolean

Type
TypeError
Returns:

Name of the class type (constructor)

Type
string
Example
let myCodelist = new CodelistBean(jsonFromServer);
myCodelist.getClassType(); // returns 'CodelistBean' 
myCodelist.getClassType(true); // returns 'Codelist' 

getDecimals()

get the maximum number of decimals places (only relevant for numerical formats)

Returns:

the Decimals value

Type
string

getEndTime()

get the end time (only relevant for time formats which have a sequence)

Returns:

the EndTime value

Type
string

getEndValue()

Returns the end value (only relevant for numeric formats which have a sequence)

Returns:

the EndValue value

Type
string

getGuid()

Returns a non-editable unique Identifier for this bean, for client side only.

This GUID is generated automatically on the client on construction, the GUID is completely random and will not be the same for a structure with the same URN if the physical object differes.

Inherited From:
Returns:

An immutable string containing the a unique identifier for this structure

Type
string
Example
var jsonCL = 'get JSON from server
var codelist1 = new Codelist(jsonCL);
var codelist2 = new Codelist(jsonCL);

console.log(codelist1.getUrn() === codelist2.getUrn()); //outputs true
console.log(codelist1._guid() === codelist2._guid()); //outputs false

getInterval()

Returns the interval (only relevant for numeric formats which have a sequence)

Returns:

the Interval value

Type
string

getMaintainableParent()

Returns the bean.base.MaintainableBean to which which this structure belongs. All structures must either be a MaintainableBean or be contained within a MaintainableBean.

If this class is a MaintainableBean, then it will return itself as MaintainableBean is the outermost container for all structures

Inherited From:
Returns:

This objects maintainable parent

Type
bean.base.MaintainableBean
Example
var annualCode = myCodeList.getItem("A");
annualCode.getMaintainableParent() // returns 'myCodeList'

getMaxLength()

Returns the maximum value that this can take (only relevant for string formats)

Returns:

the MaxLength value

Type
string

getMaxValue()

Returns the maximum value that this can take (only relevant for numeric formats)

Returns:

the MaxValue value

Type
string

getMinLength()

Returns the minimum length that this can take (only relevant for string formats)

Returns:

the MinLength value

Type
string

getMinValue()

Returns the minimum value that this can take (only relevant for numeric formats)

Returns:

the MinValue value

Type
string

getMultiLingual()

Returns true if multilingual text is allowed

Returns:

the MultiLingual value

Type
boolean

getParent( [clazz])

Get the parent structure for which this structure is contained

Parameters:
Name Type Argument Description
clazz object <optional>

If supplied will walk up the parent hierarchy until the parent is of this type

Inherited From:
Returns:

The parent for this object

Type
bean.base.Bean
Example
var dsd = dimension.getParent(DataStructureBean); // note that 'DataStructureBean' is not a string but a Class

getPattern()

Retursn a reg-ex expression that the sting must conform to

Returns:

the Pattern value

Type
string

getSequence()

Returns true if the value follows a sequence (this can be numerical or time related sequences)

See:
  • #getStartValue, #getEndValue, #getInterval, #getTimeInterval
Returns:

the Sequence value

Type
string

getStartTime()

get the start time (only relevant for time formats which have a sequence)

Returns:

the StartTime value

Type
string

getStartValue()

Returns the start value (only relevant for numeric formats which have a sequence)

Returns:

the StartValue value

Type
string

getTextType()

Returns the TextType which defines the expected format of the text.

The returned value is a can be one of the following strings:
Alpha,
AlphaNumeric,
AttachmentConstraintReference,
BasicTimePeriod,
String,
BigInteger,
Integer,
Long,
Short,
Decimal,
Float,
Double,
Boolean,
DateTime,
Time,
Month,
Numeric,
Day,
MonthDay,
Duration,
URI,
Count,
DataSetReference,
InclusiveValueRange,
ExclusiveValueRange,
Incremental,
ObservationalTimePeriod,
KeyValues,
GregorianDay,
GregorianTimePeriod,
GregorianYear,
GregorianYearMonth,
ReportingDay,
ReportingMonth,
ReportingQuarter,
ReportingSemester,
ReportingTimePeriod,
ReportingTrimester,
ReportingWeek,
ReportingYear,
StandardTimePeriod,
TimeRange,
IdentifiableReference,
XHTML

Returns:

the TextType value

Type
string

getTimeInterval()

get the TimeInterval (only relevant for time formats which have a sequence)

Returns:

the TimeInterva value

Type
string

hasEndTime()

Returns true if this has a EndTime

Returns:

true if this has a EndTime

Type
boolean

hasEndValue()

Returns true if this has a EndValue

Returns:

true if EndValue

Type
boolean

hasInterval()

Returns true if this has a Interval

Returns:

true if this has a Interval

Type
boolean

hasMaxLength()

Returns true if this has a MaxLength

Returns:

true if MaxLength

Type
boolean

hasMaxValue()

Returns true if this has a MaxValue

Returns:

true if this has a MaxValue

Type
boolean

hasMinLength()

Returns true if this has a MinLength

Returns:

true if MinLength

Type
boolean

hasMinValue()

Returns true if this has a MinValue

Returns:

true if this has a MinValue

Type
boolean

hasPattern()

Returns true if this has a Pattern

Returns:

true if this has a Pattern

Type
boolean

hasRestrictions()

Returns true if there are other restrictions then simply text type

Returns:

true if there are other restrictions then simply text type

Type
boolean

hasSequence()

Returns true if this has Sequence

Returns:

true if this has Sequence

Type
boolean

hasStartTime()

Returns true if this has a StartTime

Returns:

true if this has a StartTime

Type
boolean

hasStartTime()

Returns true if this has Decimals

Returns:

true if this has Decimals

Type
boolean

hasStartValue()

Returns true if this has a StartValue

Returns:

true if StartValue

Type
boolean

hasTimeInterval()

Returns true if this has a TimeInterval

Returns:

true if this has a TimeInterval

Type
boolean

toString()

Returns a string that represents this Bean.

If this Bean is an bean.base.IdentifiableBean then this will output the URN, otherwise the GUID will be returned

Inherited From:
Returns:

The URN or GUID

Type
string
Example
let myCodelist = new CodelistBean(jsonFromServer);
myCodelist.toString() // returns: 'urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_FREQ(1.0)'