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 Fields.
  • 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