public class FeaturableModel extends Object implements Featurable
Constructor and Description |
---|
FeaturableModel()
Create model.
|
FeaturableModel(Setup setup)
Create model.
|
Modifier and Type | Method and Description |
---|---|
void |
addFeature(Feature feature)
Add a feature.
|
<T extends Feature> |
addFeatureAndGet(T feature)
Add a feature and retrieve it.
|
void |
addFeatures(Setup setup)
Add features.
|
static void |
clearCache()
Clear classes cache.
|
<C extends Feature> |
getFeature(Class<C> feature)
Get a feature instance from its type.
|
Iterable<Feature> |
getFeatures()
Get the supported features.
|
Iterable<Class<? extends Feature>> |
getFeaturesType()
Get the supported features type.
|
Media |
getMedia()
Get the associated media.
|
boolean |
hasFeature(Class<? extends Feature> feature)
Check a feature existence from its type.
|
boolean |
isPrepared()
Check if features are prepared.
|
void |
prepareFeatures(Services services)
Prepare all added feature.
|
public FeaturableModel()
public FeaturableModel(Setup setup)
setup
- The setup reference.public static void clearCache()
public void prepareFeatures(Services services)
Featurable
This will call Feature.prepare(FeatureProvider, Services)
and Feature.checkListener(Object)
for
each, fill annotated fields with Service
with the right instance provided by the Services
.
prepareFeatures
in interface Featurable
services
- The services reference.public final void addFeature(Feature feature)
Featurable
Caution:
At this point the feature may not be completely usable. A call to Featurable.prepareFeatures(Services)
is required
for a full usage, as annotated fields with Service
will not be filled.
addFeature
in interface Featurable
feature
- The feature to add.public final void addFeatures(Setup setup)
Featurable
Caution:
At this point features may not be completely usable. A call to Featurable.prepareFeatures(Services)
is required
for a full usage, as annotated fields with Service
will not be filled.
addFeatures
in interface Featurable
setup
- The features to read from setup.public final <T extends Feature> T addFeatureAndGet(T feature)
Featurable
FeaturableConfig.NODE_FEATURE
nodes.
Caution:
At this point the feature may not be completely usable. A call to Featurable.prepareFeatures(Services)
is required
for a full usage, as annotated fields with Service
will not be filled.
addFeatureAndGet
in interface Featurable
T
- The feature type.feature
- The feature to add.public final <C extends Feature> C getFeature(Class<C> feature)
FeatureProvider
Feature
is not prepared.getFeature
in interface FeatureProvider
C
- The custom feature type.feature
- The feature type.public final Iterable<Feature> getFeatures()
FeatureProvider
getFeatures
in interface FeatureProvider
public final Iterable<Class<? extends Feature>> getFeaturesType()
FeatureProvider
getFeaturesType
in interface FeatureProvider
public final boolean hasFeature(Class<? extends Feature> feature)
FeatureProvider
hasFeature
in interface FeatureProvider
feature
- The feature type.true
if feature exists, false
else.public final boolean isPrepared()
Featurable
isPrepared
in interface Featurable
true
if features prepared, false
else.public Media getMedia()
Featurable
getMedia
in interface Featurable
null
if none.Copyright © 2016 Byron 3D Games Studio. All rights reserved.