org.csc.phynixx.common.cast
Class Implementor

java.lang.Object
  extended by org.csc.phynixx.common.cast.Implementor
All Implemented Interfaces:
IImplementor

public class Implementor
extends Object
implements IImplementor

Als Superklasse casted diese Klasse in die Subclass gegebene durch this.getClass()

Author:
Christoph Schmidt-Casdorff

Constructor Summary
Implementor()
           
 
Method Summary
<X> X
cast(Class<X> iface)
          prueft, ob uebergebene Klasse assignable von aktueller Klasse ist.
<X> boolean
isImplementationOf(Class<X> cls)
          Prueft, ob cast in die gewuenschte Zielklasse moeglich ist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Implementor

public Implementor()
Method Detail

cast

public <X> X cast(Class<X> iface)
prueft, ob uebergebene Klasse assignable von aktueller Klasse ist.

Specified by:
cast in interface IImplementor
Parameters:
iface - Zielklasse
Returns:
Objekt, welche das gewuenschte Klasse implementiert. Es wird kein Zusammenhang zwischen Ausgangsobjekt und Resultat vorausgesetzt (wie .z.B. sub/super, implements, instanceof etc)

isImplementationOf

public <X> boolean isImplementationOf(Class<X> cls)
Description copied from interface: IImplementor
Prueft, ob cast in die gewuenschte Zielklasse moeglich ist.

Ist cls==null, so wird false geliefert.

Specified by:
isImplementationOf in interface IImplementor
Type Parameters:
X - expected (Super)Type of the checked object
Parameters:
cls - target class / interface
Returns:
true if the current class can be safely casted to X


Copyright © 2015. All rights reserved.