Satisfied Interfaces: Annotated, AnnotatedDeclaration, Declaration, FunctionOrValueDeclaration, NestableDeclaration, TypedDeclaration

A value declaration.

### Usage sample for toplevel value

Getting a model requires applying type arguments to the value declaration with apply in order to be able to read that value. For example, here is how you would obtain a value model that you can read from a toplevel attribute declaration:

    String foo = "Hello";

    void test(){
        // We need to apply the the foo declaration in order to get the foo value model
        Value<String> valueModel = `value foo`.apply<String>();
        // This will print: Hello
        print(valueModel.get());
    }

### Usage sample for attributes

For attributes it is a bit longer, because attributes need to be applied the containing type, so you should use memberApply and start by giving the containing closed type:

    class Outer(){
        shared String foo => "Hello";
    }

    void test(){
        // Apply the containing closed type `Outer` to the attribute declaration `Outer.foo`
        Attribute<Outer,String> valueModel = `value Outer.foo`.memberApply<Outer,String>(`Outer`);
        // We now have an Attribute, which needs to be applied to a containing instance in order to become a
        // readable value:
        Value<String> boundValueModel = valueModel(Outer());
        // This will print: Hello
        print(boundValueModel.get());
    }

Attributes
setter | Source Code shared formal SetterDeclaration setter Returns the setter declaration for this variable. For modelling purposes `variable` reference values have a SetterDeclaration even though there is no such setter explicit in the source code.
variable | Source Code shared formal Boolean variable True if this declaration is annotated with variable.

Inherited Attributes
Attributes inherited from: Object hash, string
Attributes inherited from: Declaration name, qualifiedName
Attributes inherited from: FunctionOrValueDeclaration defaulted, parameter, variadic
Attributes inherited from: NestableDeclaration actual, container, containingModule, containingPackage, default, formal, shared, toplevel
Attributes inherited from: TypedDeclaration openType

Methods
apply | Source Code shared formal Value<Get,Set> apply<Get = Anything, Set = Nothing>() Applies this value declaration in order to obtain a value model. See this code sample for an example on how to use this. Throws: IncompatibleTypeException If the specified `Get` or `Set` type arguments are not compatible with the actual result.
get | Source Code shared default Anything get() Reads the current value of this toplevel value.
memberApply | Source Code shared formal Attribute<Container,Get,Set> memberApply<Container = Nothing, Get = Anything, Set = Nothing>(Type<Container> containerType) Applies the given closed container type to this attribute declaration in order to obtain an attribute model. See this code sample for an example on how to use this. Throws: IncompatibleTypeException If the specified `Container`, `Get` or `Set` type arguments are not compatible with the actual result.
memberGet | Source Code shared default Anything memberGet(Object container) Reads the current value of this attribute on the given container instance. Throws: IncompatibleTypeException If the specified container is not compatible with this attribute.
memberSet | Source Code shared formal void memberSet(Object container, Anything newValue) Sets the current value of this attribute on the given container instance. Throws: IncompatibleTypeException If the specified container or new value type is not compatible with this attribute.
set | Source Code shared default void set(Anything newValue) Sets the current value of this toplevel value.

Inherited Methods
Methods inherited from: Object equals
Methods inherited from: AnnotatedDeclaration annotations