    

 ## On this page

  

 

 # Class PHXString

 Last update: 22.06.2026 

**Package:** `com.phoenix_int.aserver.types`

```
↳ java.lang.Object
  ↳ com.phoenix_int.aserver.types.PHXSimpleType
    ↳ com.phoenix_int.aserver.types.PHXString

```

**All Implemented Interfaces:**

- [IPHXType](IPHXType.md), [IPHXType2](IPHXType2.md), [IPHXUnits](IPHXUnits.md)

---

```java
public class PHXString
extends PHXSimpleType

```

The type for Strings. This class adds the following features to the [PHXSimpleType](PHXSimpleType.md):

- **value**: String
- **enumValues**: String\[\]
- **enumAliases**: String\[\]

**See Also:**

- [PHXSimpleType](PHXSimpleType.md)

## Nested Class Summary

### Nested classes/interfaces inherited from interface com.phoenix\_int.aserver.types.[IPHXType2](IPHXType2.md)

`IPHXType2.IVisitor<t>`

## Constructor Summary

Constructor and Description`PHXString()``PHXString(PHXStringother)`  
Clone another PHXString's value and metadata.`PHXString(java.lang.String&nbsp;value)`## Method Summary

Modifier and TypeMethod and Description`protected void``_copyMetadataFromOther(PHXStringother)`  
Clone another PHXString's metadata.`<t>&nbsp;T``Accept(IPHXType2.IVisitor<t>&nbsp;visitor)`  
Accept a Visitor.`static java.lang.String``arrayToString(java.lang.String[]&nbsp;sa)`  
Deprecated.`static java.lang.String``arrayToStringEscaped(java.lang.String[]&nbsp;sa)`  
Quotes each element of the array using c-style escape sequences, then builds a comma separated list of the elements with quotes around each element.`PHXString``createCopy()`  
Create a copy of this instance, including the value and metadata.`boolean``equalsNatural(PHXSimpleTypetoCompare)`  
Compare this PHXSimpleType to another PHXSimpleType.`void``fromObject(java.lang.Object&nbsp;toRead)`  
Load the value of this object from the specified object.`void``fromString(java.lang.String&nbsp;value)`  
converts a String representation to the internal value`void``fromString2(PHXStringBuffervalue)`  
converts a PHXStringBuffer representation to the internal value`java.lang.String[]``getEnumAliases()`  
An interface function for the enumeration array`java.lang.String``getEnumAliasesStr()`  
An interface function for the enumeration array`java.lang.String[]``getEnumValues()`  
lists enum values`java.lang.String``getEnumValuesStr()`  
Interface function to pass out the enumeration array as a comma separated string`java.lang.String``getValue()`  
retrieves the current value of the variable`static void``main(java.lang.String[]&nbsp;args)``void``setEnumAliases(java.lang.String&nbsp;values)`  
takes a comma separated string of values and fills the enumeration aliases list with values.`void``setEnumAliases(java.lang.String[]&nbsp;values)`  
Takes an array of values and fills the enumeration aliases list with values.`void``setEnumValues(java.lang.String&nbsp;input)`  
sets enum values`void``setEnumValues(java.lang.String[]&nbsp;values)`  
sets enum values`void``setValue(PHXStringBufferv)`  
sets the value for the variable`void``setValue(java.lang.String&nbsp;v)`  
sets the value for the variable`static java.lang.String[]``stringToArray(java.lang.String&nbsp;s)``java.lang.String``toString()`  
converts the variable to a string`PHXStringBuffer``toString2()`  
converts the variable to a PHXStringBuffer### Methods inherited from class com.phoenix\_int.aserver.types.[PHXSimpleType](PHXSimpleType.md)

`_copyMetadataFromOther`, `addPropertyChangeListener`, `getDescription`, `getEnumTokens`, `getHasChanged`, `getUnits`,`removePropertyChangeListener`, `setDescription`, `setHasChanged`, `setUnits`

### Methods inherited from class java.lang.Object

`clone`, `equals`, `finalize`, `getClass`, `hashCode`, `notify`, `notifyAll`, `wait`, `wait`, `wait`

## Constructor Detail

### PHXString

```java
public&nbsp;PHXString()

```

### PHXString

```java
public&nbsp;PHXString(java.lang.String&nbsp;value)

```

### PHXString

```java
public&nbsp;PHXString(PHXString&nbsp;other)

```

Clone another PHXString's value and metadata.

**Parameters:**

- `other` - the other PHXString to clone.

## Method Detail

### getValue

```java
public&nbsp;java.lang.String&nbsp;getValue()

```

Retrieves the current value of the variable

**Returns:**

- the value of the variable

### setValue

```java
public&nbsp;void&nbsp;setValue(java.lang.String&nbsp;v)
              throws java.lang.IllegalArgumentException

```

Sets the value for the variable

**Parameters:**

- `v` - the value

**Throws:**

- `java.lang.IllegalArgumentException`

### setValue

```java
public&nbsp;void&nbsp;setValue(PHXStringBuffer&nbsp;v)
              throws java.lang.IllegalArgumentException

```

Sets the value for the variable

**Parameters:**

- `v` - the value

**Throws:**

- `java.lang.IllegalArgumentException`

### toString2

```java
public&nbsp;PHXStringBuffer&nbsp;toString2()

```

Converts the variable to a PHXStringBuffer

**Returns:**

- a PHXStringBuffer representation of the variable

### toString

```java
public&nbsp;java.lang.String&nbsp;toString()

```

Converts the variable to a string

**Specified by:**

- `toString` in interface [`IPHXType`](IPHXType.md)

**Overrides:**

- `toString` in class `java.lang.Object`

**Returns:**

- a String representation of the variable

### fromString2

```java
public&nbsp;void&nbsp;fromString2(PHXStringBuffer&nbsp;value)

```

Converts a PHXStringBuffer representation to the internal value

**Parameters:**

- `value` - the value to convert

### fromString

```java
public&nbsp;void&nbsp;fromString(java.lang.String&nbsp;value)

```

Converts a String representation to the internal value

**Parameters:**

- `value` - the value to convert

### getEnumValues

```java
public&nbsp;java.lang.String[]&nbsp;getEnumValues()

```

Lists enum values

**Returns:**

- enum values

### getEnumValuesStr

```java
public&nbsp;java.lang.String&nbsp;getEnumValuesStr()

```

Interface function to pass out the enumeration array as a comma separated string

**Returns:**

- comma separated string of the possible values of the list

### setEnumValues

```java
public&nbsp;void&nbsp;setEnumValues(java.lang.String&nbsp;input)

```

Sets enum values

**Parameters:**

- `input:` - list of enum values

### setEnumValues

```java
public&nbsp;void&nbsp;setEnumValues(java.lang.String[]&nbsp;values)

```

Sets enum values

**Parameters:**

- `values:` - list of enum values

### setEnumAliases

```java
public&nbsp;void&nbsp;setEnumAliases(java.lang.String&nbsp;values)

```

Takes a comma separated string of values and fills the enumeration aliases list with values.

**Parameters:**

- `values` - A comma separated string of enumeration aliases

### setEnumAliases

```java
public&nbsp;void&nbsp;setEnumAliases(java.lang.String[]&nbsp;values)

```

Takes an array of values and fills the enumeration aliases list with values. If null, aliases will be set to an empty list.

**Parameters:**

- `values` - string array of enumeration aliases

### getEnumAliases

```java
public&nbsp;java.lang.String[]&nbsp;getEnumAliases()

```

An interface function for the enumeration array

**Returns:**

- an array of the possible values of the list

### getEnumAliasesStr

```java
public&nbsp;java.lang.String&nbsp;getEnumAliasesStr()

```

An interface function for the enumeration array

**Returns:**

- an comma separated string of the possible values of the list

### \_copyMetadataFromOther

```java
protected final&nbsp;void&nbsp;_copyMetadataFromOther(PHXString&nbsp;other)

```

Clone another PHXString's metadata.

**Parameters:**

- `other` - the other PHXString

### arrayToString

```java
@Deprecated
public static&nbsp;java.lang.String&nbsp;arrayToString(java.lang.String[]&nbsp;sa)

```

**Deprecated.** Do not use, does not generate correct strings.

**Parameters:**

- `sa` -

**Returns:**

### stringToArray

```java
public static&nbsp;java.lang.String[]&nbsp;stringToArray(java.lang.String&nbsp;s)

```

### arrayToStringEscaped

```java
public static&nbsp;java.lang.String&nbsp;arrayToStringEscaped(java.lang.String[]&nbsp;sa)

```

Quotes each element of the array using c-style escape sequences, then builds a comma separated list of the elements with quotes around each element.

**Parameters:**

- `sa` - The array to read

**Returns:**

- The generated string.

### main

```java
public static&nbsp;void&nbsp;main(java.lang.String[]&nbsp;args)

```

### equalsNatural

```java
public&nbsp;boolean&nbsp;equalsNatural(PHXSimpleType&nbsp;toCompare)
                      throws PHXTypeMismatchException

```

Compare this PHXSimpleType to another PHXSimpleType. This type of comparison is different than `Comparable` in that it does a natural comparison between numbers. It is not designed, nor suited, for use in things such as sets, and may behave oddly if put in those circumstances.

**Specified by:**

- `equalsNatural` in class [`PHXSimpleType`](PHXSimpleType.md)

**Parameters:**

- `toCompare` -

**Returns:**

- a negative number if this object is less than `toCompare`, a positive number if this object is greater than `toCompare`, and zero if these two objects are equal.

**Throws:**

- `PHXTypeMismatchException` - if the given PHXSimpleType cannot be compared with this object.

### fromObject

```java
public&nbsp;void&nbsp;fromObject(java.lang.Object&nbsp;toRead)
                throws PHXInvalidTypeException

```

Load the value of this object from the specified object. This will read the object and attempt to convert it if it is a known type. If the type isn't recognized, it will throw a [`PHXInvalidTypeException`](PHXInvalidTypeException.md). If there is an error in conversion, it will also throw a [`PHXInvalidTypeException`](PHXInvalidTypeException.md).

NOTE: while it might be logical to think you can create a `PHX(Type)Array` from, say, an array of `java.lang.(Type)`, that is not currently upported. You MUST use the PHX string array formatting style.

**Specified by:**

- `fromObject` in class [`PHXSimpleType`](PHXSimpleType.md)

**Parameters:**

- `toRead` - to object from which to load this objects value.

**Throws:**

- [`PHXInvalidTypeException`](PHXInvalidTypeException.md)- if the specified object is of an invalid type or there is an error in conversion.

### Accept

```java
public&nbsp;<t>&nbsp;T&nbsp;Accept(IPHXType2.IVisitor<t>&nbsp;visitor)

```

Accept a Visitor.

**Type Parameters:**

- `T` - Type of the result of the visit.

**Parameters:**

- `visitor` - The visitor to accept.

**Returns:**

- The results of the visit.

### createCopy

```java
public&nbsp;PHXString&nbsp;createCopy()

```

Create a copy of this instance, including the value and metadata.

**Specified by:**

- `createCopy` in class [`PHXSimpleType`](PHXSimpleType.md)

**Returns:**

- a newly constructed copy of this instance.