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 ofField
s.
-
-
Field Summary
Fields Modifier and Type Field Description 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 Constructor Description FieldContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the values of all registered fields.Field
findField(java.lang.Object context, java.lang.String name)
Finds the corresponding field forField
findStaticField(java.lang.Object context, java.lang.String name)
Finds the corresponding static field forboolean
hasField(java.lang.String name)
Returnstrue
iff this execution environment has any registered fields with the givenname
.boolean
hasStaticField(java.lang.String name)
Returnstrue
iff this execution environment has any registered static fields with the givenname
.void
registerField(Field f)
Registers f in the corresponding lookup table.java.lang.String
toString()
-
-
-
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
null
if not found - Throws:
DuplicateEntryException
- if there is a field conflict
-
hasField
public boolean hasField(java.lang.String name)
Returnstrue
iff this execution environment has any registered fields with the givenname
.- Parameters:
name
- the field name- Returns:
true
iff 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
null
if not found - Throws:
DuplicateEntryException
- if there is a field conflict
-
hasStaticField
public boolean hasStaticField(java.lang.String name)
Returnstrue
iff this execution environment has any registered static fields with the givenname
.- Parameters:
name
- the field name- Returns:
true
iff 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:
toString
in classjava.lang.Object
-
-