Class Personality<T>

  • Direct Known Subclasses:
    GraphPersonality, NodePersonality

    public class Personality<T>
    extends java.lang.Object
    Defines a set of permitted mappings from [interface] Class objects to Implementation factories that can generate instances of the facet represented by the Class.
    • Constructor Summary

      Constructors 
      Constructor Description
      Personality()
      base constructor, does nothing [except implicitly create _types_]
      Personality​(Personality<T> other)
      initialise this personality with the bindings from _other_
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <X extends T>
      Personality<T>
      add​(java.lang.Class<X> interf, Implementation impl)
      Add a new interface and its implementation to this Personality.
      Personality<T> add​(Personality<T> p)
      extend this personality by adding in all the mappings from the argument _p_.
      Personality<T> copy()
      create a new Personality copying this one; the _types_ state is copied, not shared.
      <X extends T>
      Implementation
      getImplementation​(java.lang.Class<X> t)
      get the implementation for the specified type, returning null if there isn't one available.
      <X extends T>
      X
      newInstance​(java.lang.Class<X> interf, Node n, EnhGraph that)
      make a new instance of a type _interf_ based on the node _n_ and the polymorphic _that_; use the implementation wrapper for _interf_ in _types_.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Personality

        public Personality()
        base constructor, does nothing [except implicitly create _types_]
      • Personality

        public Personality​(Personality<T> other)
        initialise this personality with the bindings from _other_
    • Method Detail

      • add

        public <X extends TPersonality<T> add​(java.lang.Class<X> interf,
                                                Implementation impl)
        Add a new interface and its implementation to this Personality.
        Parameters:
        interf - The interface to add, expressed as a Type object.
        impl - A way of implementing _interf_.
      • copy

        public Personality<T> copy()
        create a new Personality copying this one; the _types_ state is copied, not shared.
      • getImplementation

        public <X extends TImplementation getImplementation​(java.lang.Class<X> t)
        get the implementation for the specified type, returning null if there isn't one available.
      • add

        public Personality<T> add​(Personality<T> p)
        extend this personality by adding in all the mappings from the argument _p_. return _this_ (for call chaining).
      • newInstance

        public <X extends T> X newInstance​(java.lang.Class<X> interf,
                                           Node n,
                                           EnhGraph that)
        make a new instance of a type _interf_ based on the node _n_ and the polymorphic _that_; use the implementation wrapper for _interf_ in _types_.