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

# Class FieldContainer

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

public final class FieldContainer extends Object
Reusable class for storage and lookup of `Field`s.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final Set<Field>`
`allFields`
Set of all fields (for clearing values).
`protected final Map<String,TypeMap<Object,Field>>`
`fields`
Lookup table for fields: (name -> (context -> field)).
`protected final Map<String,TypeMap<Object,Field>>`
`staticFields`
Lookup table for static fields: (name -> (context -> field)).

## Constructor Summary

Constructors
Constructor
Description
`FieldContainer()`

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
Clears the values of all registered fields.
`Field`
`findField(Object context, String name)`
Finds the corresponding field for
`Field`
`findStaticField(Object context, String name)`
Finds the corresponding static field for
`boolean`
`hasField(String name)`
Returns `true` iff this execution environment has any registered fields with the given `name`.
`boolean`
`hasStaticField(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.
`String`
`toString()`

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

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

## Field Details

### fields

protected final Map<String,TypeMap<Object,Field>> fields
Lookup table for fields: (name -> (context -> field)).

### staticFields

protected final Map<String,TypeMap<Object,Field>> staticFields
Lookup table for static fields: (name -> (context -> field)).

### allFields

protected final Set<Field> allFields
Set of all fields (for clearing values).

## Constructor Details

### FieldContainer

public FieldContainer()

## Method Details

### registerField

public void registerField(Field f)
Registers f in the corresponding lookup table.

Parameters:
  `f` - the field to register

### findField

public Field findField(Object context, 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(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(Object context, 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(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 String toString()

Overrides:
  `toString` in class `Object`