Package org.eclipse.m2m.atl.emftvm.util

## Class FieldContainer

- java.lang.Object
- - org.eclipse.m2m.atl.emftvm.util.FieldContainer

    public final class FieldContainer
    extends java.lang.Object

Reusable class for storage and lookup of `Field`s.

### Field Summary

Fields
`protected java.util.Set<Field>` `allFields` Set of all fields (for clearing values).
`protected java.util.Map<java.lang.String,​TypeMap<java.lang.Object,​Field>>` `fields` Lookup table for fields: (name -> (context -> field)).
`protected java.util.Map<java.lang.String,​TypeMap<java.lang.Object,​Field>>` `staticFields` Lookup table for static fields: (name -> (context -> field)).

### Constructor Summary

Constructors
`FieldContainer()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clear()` Clears the values of all registered fields.
`Field` `findField​(java.lang.Object context, java.lang.String name)` Finds the corresponding field for
`Field` `findStaticField​(java.lang.Object context, java.lang.String name)` Finds the corresponding static field for
`boolean` `hasField​(java.lang.String name)` Returns `true` iff this execution environment has any registered fields with the given `name`.
`boolean` `hasStaticField​(java.lang.String name)` Returns `true` iff this execution environment has any registered static fields with the given `name`.
`void` `registerField​(Field f)` Registers f in the corresponding lookup table.
`java.lang.String` `toString()`

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

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

### Field Detail

#### fields

    protected final java.util.Map<java.lang.String,​TypeMap<java.lang.Object,​Field>> fields

Lookup table for fields: (name -> (context -> field)).

#### staticFields

    protected final java.util.Map<java.lang.String,​TypeMap<java.lang.Object,​Field>> staticFields

Lookup table for static fields: (name -> (context -> field)).

#### allFields

    protected final java.util.Set<Field> allFields

Set of all fields (for clearing values).

### Constructor Detail

#### FieldContainer

    public FieldContainer()

### Method Detail

#### registerField

    public void registerField​(Field f)

Registers f in the corresponding lookup table.

Parameters:
  `f` - the field to register

#### findField

    public Field findField​(java.lang.Object context,
                           java.lang.String name)
                    throws DuplicateEntryException

Finds the corresponding field for

    name

and

    context

.

Parameters:
  `context` - the context type of the field
  `name` - the name of the field
Returns:
  the corresponding field, or `null` if not found
Throws:
  `DuplicateEntryException` - if there is a field conflict

#### hasField

    public boolean hasField​(java.lang.String name)

Returns `true` iff this execution environment has any registered fields with the given `name`.

Parameters:
  `name` - the field name
Returns:
  `true` iff this execution environment has any registered fields with the given `name`

#### findStaticField

    public Field findStaticField​(java.lang.Object context,
                                 java.lang.String name)
                          throws DuplicateEntryException

Finds the corresponding static field for

    name

and

    context

.

Parameters:
  `context` - the context type of the field
  `name` - the name of the field
Returns:
  the corresponding field, or `null` if not found
Throws:
  `DuplicateEntryException` - if there is a field conflict

#### hasStaticField

    public boolean hasStaticField​(java.lang.String name)

Returns `true` iff this execution environment has any registered static fields with the given `name`.

Parameters:
  `name` - the field name
Returns:
  `true` iff this execution environment has any registered static fields with the given `name`

#### clear

    public void clear()

Clears the values of all registered fields.

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`