public class FeatureModel extends Object implements Feature
Any feature can override checkListener(Object)
to automatically add listener on object if implements
it/them.
Constructor and Description |
---|
FeatureModel()
Create model.
|
Modifier and Type | Method and Description |
---|---|
void |
checkListener(Object listener)
Check object interface listening and add them automatically.
|
<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.
|
boolean |
hasFeature(Class<? extends Feature> feature)
Check a feature existence from its type.
|
void |
prepare(FeatureProvider provider)
Prepare the feature.
|
public void prepare(FeatureProvider provider)
Feature
Featurable.addFeature(Feature)
or
Featurable.addFeatureAndGet(Feature)
.public void checkListener(Object listener)
Feature
provide listeners, this will
allow to add them automatically.
Does nothing by default.
checkListener
in interface Feature
listener
- The listener to check.public <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 Iterable<Feature> getFeatures()
FeatureProvider
getFeatures
in interface FeatureProvider
public Iterable<Class<? extends Feature>> getFeaturesType()
FeatureProvider
getFeaturesType
in interface FeatureProvider
public boolean hasFeature(Class<? extends Feature> feature)
FeatureProvider
hasFeature
in interface FeatureProvider
feature
- The feature type.true
if feature exists, false
else.Copyright © 2017 Byron 3D Games Studio. All rights reserved.