Class AbstractPropertyExtractor
- java.lang.Object
-
- adams.gui.visualization.debug.propertyextractor.AbstractPropertyExtractor
-
- All Implemented Interfaces:
CleanUpHandler
- Direct Known Subclasses:
DefaultPropertyExtractor
,Mat5ArrayPropertyExtractor
,NotesPropertyExtractor
,OptionHandlerPropertyExtractor
,VariablesPropertyExtractor
public abstract class AbstractPropertyExtractor extends Object implements CleanUpHandler
Ancestor for property extractors, used for populating the object tree.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected static Hashtable<Class,List<Class>>
m_Cache
the cache for object class / extractor relation.protected Object
m_Current
the current object to inspect.protected static Class[]
m_ExtractorClasses
the extractors (classes) currently available.protected static String[]
m_Extractors
the extractors (classnames) currently available.
-
Constructor Summary
Constructors Constructor Description AbstractPropertyExtractor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.Object
getCurrent()
Returns the current object that is inspected.static AbstractPropertyExtractor
getExtractor(Class cls)
Returns the first extractor for the specified class.static AbstractPropertyExtractor
getExtractor(Object obj)
Returns the first extractor for the specified object.static List<AbstractPropertyExtractor>
getExtractors(Class cls)
Returns all the extractors for the specified class.static List<AbstractPropertyExtractor>
getExtractors(Object obj)
Returns all the extractors for the specified object.abstract String
getLabel(int index)
Returns the label for the specified property.abstract Object
getValue(int index)
Returns the current value of the specified property.abstract boolean
handles(Class cls)
Checks whether this extractor actually handles this type of class.boolean
hasValue(int index)
Checks whether the specified property has a value.protected static void
initExtractors()
Initializes the extractors.protected void
initialize()
Initializes the extractor.void
setCurrent(Object value)
Sets the current object to inspect.abstract int
size()
The number of properties that are available.
-
-
-
Field Detail
-
m_Cache
protected static Hashtable<Class,List<Class>> m_Cache
the cache for object class / extractor relation.
-
m_Extractors
protected static String[] m_Extractors
the extractors (classnames) currently available.
-
m_ExtractorClasses
protected static Class[] m_ExtractorClasses
the extractors (classes) currently available.
-
m_Current
protected Object m_Current
the current object to inspect.
-
-
Method Detail
-
initExtractors
protected static void initExtractors()
Initializes the extractors.
-
getExtractor
public static AbstractPropertyExtractor getExtractor(Object obj)
Returns the first extractor for the specified object.- Parameters:
obj
- the object to get an extractor for- Returns:
- the extractor
-
getExtractor
public static AbstractPropertyExtractor getExtractor(Class cls)
Returns the first extractor for the specified class.- Parameters:
cls
- the class to get an extractor for- Returns:
- the extractor
-
getExtractors
public static List<AbstractPropertyExtractor> getExtractors(Object obj)
Returns all the extractors for the specified object.- Parameters:
obj
- the object to get the extractors for- Returns:
- the extractors
-
getExtractors
public static List<AbstractPropertyExtractor> getExtractors(Class cls)
Returns all the extractors for the specified class.- Parameters:
cls
- the class to get the extractors for- Returns:
- the extractors
-
handles
public abstract boolean handles(Class cls)
Checks whether this extractor actually handles this type of class.- Parameters:
cls
- the class to check- Returns:
- true if the extractor handles the object/class
-
setCurrent
public void setCurrent(Object value)
Sets the current object to inspect.- Parameters:
value
- the object to inspect- See Also:
initialize()
-
getCurrent
public Object getCurrent()
Returns the current object that is inspected.- Returns:
- the current object
-
initialize
protected void initialize()
Initializes the extractor.
Default implementation does nothing.
-
size
public abstract int size()
The number of properties that are available.- Returns:
- the number of properties
-
hasValue
public boolean hasValue(int index)
Checks whether the specified property has a value.- Parameters:
index
- the index of the property to check- Returns:
- true if a value exists
-
getValue
public abstract Object getValue(int index)
Returns the current value of the specified property.- Parameters:
index
- the index of the property to retrieve- Returns:
- the current value of the property
-
getLabel
public abstract String getLabel(int index)
Returns the label for the specified property.- Parameters:
index
- the index of the property to get the label for- Returns:
- the label for the property
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-