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.ObjectReusable class for storage and lookup ofFields.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<Field>allFieldsSet of all fields (for clearing values).protected java.util.Map<java.lang.String,TypeMap<java.lang.Object,Field>>fieldsLookup table for fields: (name -> (context -> field)).protected java.util.Map<java.lang.String,TypeMap<java.lang.Object,Field>>staticFieldsLookup table for static fields: (name -> (context -> field)).
-
Constructor Summary
Constructors Constructor Description FieldContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the values of all registered fields.FieldfindField(java.lang.Object context, java.lang.String name)Finds the corresponding field forFieldfindStaticField(java.lang.Object context, java.lang.String name)Finds the corresponding static field forbooleanhasField(java.lang.String name)Returnstrueiff this execution environment has any registered fields with the givenname.booleanhasStaticField(java.lang.String name)Returnstrueiff this execution environment has any registered static fields with the givenname.voidregisterField(Field f)Registers f in the corresponding lookup table.java.lang.StringtoString()
-
-
-
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).
-
-
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 forname
andcontext
.- Parameters:
context- the context type of the fieldname- the name of the field- Returns:
- the corresponding field, or
nullif not found - Throws:
DuplicateEntryException- if there is a field conflict
-
hasField
public boolean hasField(java.lang.String name)
Returnstrueiff this execution environment has any registered fields with the givenname.- Parameters:
name- the field name- Returns:
trueiff this execution environment has any registered fields with the givenname
-
findStaticField
public Field findStaticField(java.lang.Object context, java.lang.String name) throws DuplicateEntryException
Finds the corresponding static field forname
andcontext
.- Parameters:
context- the context type of the fieldname- the name of the field- Returns:
- the corresponding field, or
nullif not found - Throws:
DuplicateEntryException- if there is a field conflict
-
hasStaticField
public boolean hasStaticField(java.lang.String name)
Returnstrueiff this execution environment has any registered static fields with the givenname.- Parameters:
name- the field name- Returns:
trueiff this execution environment has any registered static fields with the givenname
-
clear
public void clear()
Clears the values of all registered fields.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-