Elements.Origin (Java SE 26 & JDK 26)
Description: declaration: module: java.compiler, package: javax.lang.model.util, interface: Elements, enum: Origin
Keywords: javax.lang.model.util.Elements.Origin class

# Enum Class Elements.Origin

java.lang.Object
java.lang.Enum<Elements.Origin>
javax.lang.model.util.Elements.Origin

All Implemented Interfaces:
  `Serializable, Comparable<Elements.Origin>, Constable`

Enclosing interface:
  `Elements`

public static enum Elements.Origin extends Enum<Elements.Origin>
The origin of an element or other language model item. The origin of an element or item models how a construct in a program is declared in the source code, explicitly, implicitly, etc.

Note that it is possible additional kinds of origin values will be added in future versions of the platform.

See Java Language Specification:
  13.1 The Form of a Binary
Since:
  9

- ## Nested Class Summary

  ### Nested classes/interfaces declared in class Enum

  `Enum.EnumDesc<E>`
  Modifier and Type
  Class
  Description
  `static final class`
  `Enum.EnumDesc<E extends Enum<E>>`
  A nominal descriptor for an `enum` constant.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `EXPLICIT`
  Describes a construct explicitly declared in source code.
  `MANDATED`
  A mandated construct is one that is not explicitly declared in the source code, but whose presence is mandated by the specification.
  `SYNTHETIC`
  A synthetic construct is one that is neither implicitly nor explicitly declared in the source code.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isDeclared()`
  Returns `true` for values corresponding to constructs that are implicitly or explicitly declared, `false` otherwise.
  `static Elements.Origin`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static Elements.Origin[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods declared in class Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`
  Modifier and Type
  Method
  Description
  `protected final Object`
  `clone()`
  Throws CloneNotSupportedException.
  `final int`
  `compareTo(Elements.Origin o)`
  Compares this enum with the specified object for order.
  `final Optional<Enum.EnumDesc<Elements.Origin>>`
  `describeConstable()`
  Returns an enum descriptor `EnumDesc` for this instance, if one can be constructed, or an empty `Optional` if one cannot be.
  `final boolean`
  `equals(Object other)`
  Returns true if the specified object is equal to this enum constant.
  `protected final void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization has been deprecated for removal.
  `final Class<Elements.Origin>`
  `getDeclaringClass()`
  Returns the Class object corresponding to this enum constant's enum type.
  `final int`
  `hashCode()`
  Returns a hash code for this enum constant.
  `final String`
  `name()`
  Returns the name of this enum constant, exactly as declared in its enum declaration.
  `final int`
  `ordinal()`
  Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).
  `String`
  `toString()`
  Returns the name of this enum constant, as contained in the declaration.
  `static <T extends Enum<T>>
  T`
  `valueOf(Class<T> enumClass, String name)`
  Returns the enum constant of the specified enum class with the specified name.

  ### Methods declared in class Object

  `getClass, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Enum Constant Details

  - ### EXPLICIT

    public static final Elements.Origin EXPLICIT
    Describes a construct explicitly declared in source code.

  - ### MANDATED

    public static final Elements.Origin MANDATED
    A mandated construct is one that is not explicitly declared in the source code, but whose presence is mandated by the specification. Such a construct is said to be implicitly declared. One example of a mandated element is a default constructor in a class that contains no explicit constructor declarations. Another example of a mandated construct is an implicitly declared container annotation used to hold multiple annotations of a repeatable annotation interface.
    See Java Language Specification:
      8.8.9 Default Constructor
      8.9.3 Enum Members
      8.10.3 Record Members
      9.6.3 Repeatable Annotation Interfaces
      9.7.5 Multiple Annotations of the Same Interface

  - ### SYNTHETIC

    public static final Elements.Origin SYNTHETIC
    A synthetic construct is one that is neither implicitly nor explicitly declared in the source code. Such a construct is typically a translation artifact created by a compiler.

- ## Method Details

  - ### values

    public static Elements.Origin[] values()
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns:
      an array containing the constants of this enum class, in the order they are declared

  - ### valueOf

    public static Elements.Origin valueOf(String name)
    Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum class has no constant with the specified name
      `NullPointerException` - if the argument is null

  - ### isDeclared

    public boolean isDeclared()
    Returns `true` for values corresponding to constructs that are implicitly or explicitly declared, `false` otherwise.
    Returns:
      `true` for `EXPLICIT` and `MANDATED`, `false` otherwise.