Texo/Components

From Eclipsepedia

< Texo
Revision as of 08:50, 5 April 2012 by Mtaal.elver.org (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents


Introduction

At runtime Texo uses many classes to implement internal logic to (de-)serialize to and from JSON/XML, EntityManager handling and many other tasks. It can make sense for an end user application to override parts of these implementations with own classes (extending the current class).

Texo supports this through the ComponentProvider class. This class is used by Texo internals to retrieve/create an instance of internal Texo components.

Replaceable/Overrideable Texo Component

There are 30+ classes in Texo which can be replaced by own implementions. It is quite easy to find them, find the TexoComponent interface/class (use the ctrl-shift-t shortcut) and open the type hierarchy view. All the overrideable classes are displayed.


Texo-component.png


You can set your own implementation class to be use by Texo by calling the ComponentProvider.getInstance().register(...) method. It expects 2 parameters:

  • texoClass: the Texo class to override
  • implementationClass: the implementation class to use

This register method must preferably be called when the application is being initialized to ensure that your implementation class is being used from the beginning.

Static Singletons

In addition to TexoComponents, Texo also has some static singletons in some specific places. These are classes which store a singleton in a static var. The instance can be retrieved through the getInstance method. More importantly you can set your own implementation through the setInstance(..) method.

All the static singleton classes implement the TexoStaticSingleton interface, so you can easily find the one's you can replace, open the Type Hierarchy for the TexoStaticSingleton interface.

Texo-static-singleton.png