Class Field
Represents a field declaration.
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemory
Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
Syntax
public class Field : PersistentObject, ICloneable, IField
Constructors
Field()
Initializes a new instance with default values.
Declaration
public Field()
Field(Field)
Initializes a new instance with the values of another instance, creating a deep copy.
Declaration
public Field(Field other)
Parameters
Type | Name | Description |
---|---|---|
Field | other | The other instance |
Field(String, FieldValueType)
Initializes a new instance, with the specified name and type.
Declaration
public Field(string name, FieldValueType valueType)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name. |
FieldValueType | valueType | The field type. |
Fields
StructureContextFieldName
The name for the structure context field name.
Declaration
public static readonly string StructureContextFieldName
Field Value
Type | Description |
---|---|
System.String |
TextContextFieldName
A pseudo-name for the text context field. Since text context values are directly stored at the TU, and not represented as field values, this pseudo field name is only relevant for edit scripts.
Declaration
public static readonly string TextContextFieldName
Field Value
Type | Description |
---|---|
System.String |
Properties
FieldType
Gets the type of the field, i.e. whether it is a system or user-defined field.
Declaration
public FieldType FieldType { get; set; }
Property Value
Type | Description |
---|---|
FieldType |
IsSystemField
Gets a flag which indicates that this field is a system field. System fields cannot be changed or deleted by the user. Setting this flag from user-code has no effect.
Declaration
public bool IsSystemField { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Gets or sets the field name.
See IsValidName(String) for a detailed description of accepted identifiers.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PicklistItemNames
The names of all picklist items for this Field. This collection will be empty if this field is not a SinglePicklist or MultiplePicklist.
Declaration
public virtual IList<string> PicklistItemNames { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.String> |
ValueType
Gets or sets the field value type
Declaration
public FieldValueType ValueType { get; set; }
Property Value
Type | Description |
---|---|
FieldValueType |
Methods
CheckName(String)
Checks the given name and throws an exception if the name is not valid.
Declaration
protected virtual void CheckName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | name |
Clone()
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a deep copy of this instance. |
CreateValue()
Creates a FieldValue instance, with the same name and type as this field declaration.
Declaration
public FieldValue CreateValue()
Returns
Type | Description |
---|---|
FieldValue | A FieldValue instance which is compatible with this field declaration. |
Duplicate()
Creates a new instance that is a deep copy of this instance.
Declaration
public virtual Field Duplicate()
Returns
Type | Description |
---|---|
Field | A new instance that is a deep copy of this instance. |
Equals(Object)
Determines whether this instance of Field and a specified object, which must also be a Field object, represent the same field declaration including the picklist according to type.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The other object. |
Returns
Type | Description |
---|---|
System.Boolean | true if obj represents the same field declaration as this instance; false otherwise. |
Overrides
EqualsDeclaration(Field)
Determines whether this instance of Field and a specified object, which must also be a Field object, represent the same field declaration, not considering the picklist.
Declaration
public bool EqualsDeclaration(Field other)
Parameters
Type | Name | Description |
---|---|---|
Field | other | The other object. |
Returns
Type | Description |
---|---|
System.Boolean | true if other represents the same declaration but might have a different picklist; false otherwise. |
GetFieldType(String)
Determine the field type, given the field name.
Declaration
public static FieldType GetFieldType(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name to determine the field type for |
Returns
Type | Description |
---|---|
FieldType | The field type, if it can be determined, or FieldType.User if the field name is not reserved for system prposes. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
IsPseudoFieldName(String)
Determines whether the name is reserved for a pseudo (non-physical) field.
Declaration
public static bool IsPseudoFieldName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name to check |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsReservedName(String)
Determines whether the name is reserved for system purposes.
Declaration
public static bool IsReservedName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name to check |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsSystemFieldName(String)
Determines whether the specified name is reserved for a system (predefined) field.
Declaration
public static bool IsSystemFieldName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name to check |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsValidName(String)
Determines whether a specified string can be used as a field name.
All field names are valid if they don't start or end with whitespace.
Declaration
public static bool IsValidName(string val)
Parameters
Type | Name | Description |
---|---|---|
System.String | val | The string. |
Returns
Type | Description |
---|---|
System.Boolean | true if the string is a legal identifier, false otherwise. |
LookupSpecialField(String)
Looks up a special field by its name. Special fields are fields with a predefined name, which may be "virtual" fields (those computed from data at runtime) or "physical" fields (which have an actual value in the data storage). Special field names should not be used for user-defined fields. Note that special fields are a superset of system fields (i.e. not all special fields are system fields).
Declaration
public static Field LookupSpecialField(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name |
Returns
Type | Description |
---|---|
Field | The special (predefined) field, or |
RemoveIllegalChars(String)
Removes those characters from an input string which are not allowed in field names, and returns the form that will be accepted as a field name identifier. This method should only be used when fields are automatically added by some process (e.g. by importing a TMX file) and that process should be robust and continue despite invalid field names.
Declaration
public static string RemoveIllegalChars(string val)
Parameters
Type | Name | Description |
---|---|---|
System.String | val | The input string. |
Returns
Type | Description |
---|---|
System.String | The string after the illegal characters have been removed. |