共用方式為


ExpandableStringEnum<T> Class

  • java.lang.Object
    • com.azure.core.util.ExpandableStringEnum<T>

Type Parameters

T

a specific expandable enum type

Implements

public abstract class ExpandableStringEnum
implements ExpandableEnum<String>

Base implementation for expandable, single string enums.

Constructor Summary

Constructor Description
ExpandableStringEnum()

Deprecated

Use the fromString(String name, Class<T> clazz) factory method.

Creates a new instance of ExpandableStringEnum<T> without a toString() value.

Method Summary

Modifier and Type Method and Description
protected static T fromString(String name, Class<T> clazz)

Creates an instance of the specific expandable string enum from a String.

protected static Collection<T> values(Class<T> clazz)

Gets a collection of all known values to an expandable string enum type.

boolean equals(Object obj)
String getValue()

Returns the value represented by this expandable enum instance.

int hashCode()
String toString()

Methods inherited from java.lang.Object

Constructor Details

ExpandableStringEnum

@Deprecated
public ExpandableStringEnum()

Deprecated

Use the fromString(String name, Class<T> clazz) factory method.

Creates a new instance of ExpandableStringEnum<T> without a toString() value.

This constructor shouldn't be called as it will produce a ExpandableStringEnum<T> which doesn't have a String enum value.

Method Details

fromString

protected static T fromString(String name, Class clazz)

Creates an instance of the specific expandable string enum from a String.

Parameters:

name - The value to create the instance from.
clazz - The class of the expandable string enum.

Returns:

The expandable string enum instance.

values

protected static Collection values(Class clazz)

Gets a collection of all known values to an expandable string enum type.

Parameters:

clazz - the class of the expandable string enum.

Returns:

A collection of all known values for the given clazz.

equals

public boolean equals(Object obj)

Overrides:

ExpandableStringEnum<T>.equals(Object obj)

Parameters:

obj

getValue

public String getValue()

Returns the value represented by this expandable enum instance.

hashCode

public int hashCode()

Overrides:

ExpandableStringEnum<T>.hashCode()

toString

public String toString()

Overrides:

ExpandableStringEnum<T>.toString()

Applies to