Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ulu.view.sys.refl
Class ObjectShaper  view ObjectShaper download ObjectShaper.java

java.lang.Object
  extended byulu.ut.ProcessorImpl
      extended byulu.view.ShaperImpl
          extended byulu.view.sys.refl.ObjectShaper
All Implemented Interfaces:
ulu.ut.Processor, ulu.view.Shaper
Direct Known Subclasses:
BoundObjectShaper

public class ObjectShaper
extends ulu.view.ShaperImpl

A Shaper that will set a live java object as the Item's reference, in a way that allows live interaction with that object through the UI. A refactoring of the ulu.view.sys.refl.ObjectView to use the Shaper delegate interface that can be applied to any Item rather than presenting a specialist subclass.

Objects may be represented in several ways, with reflected members presented as child items (most suitable for documenting an object, say) or as properties and methods of the top-level item (which is better suited for live introspection, say). Further, bean accessor/mutator methods may be presented as properties rather than the raw methods, if desired. Distinctions may be drawn between members declared in that class, and those inherited from parent classes. We're keeping things simple for now, with the following rules:


Field Summary
(package private)  java.lang.Class cls
          class definition for this object
static java.lang.String GROUPS_SHOW_ALL
          special tab value denoting show all values
static java.lang.String MEMBER_GROUP_DECLARED
          denotes the member group of fields and methods explicitly declared by this class
static java.lang.String MEMBER_GROUP_IMPLIED
          denotes the member group of fields and methods implied by ancestry of this class
(package private)  MethodShaper methshaper
          delegate Shaper that handles reflected Methods
(package private)  java.lang.Object obj
          the object being exposed by this shaper
(package private)  PropertyShaper propshaper
          delegate Shaper that handles reflected Fields
 
Fields inherited from class ulu.ut.ProcessorImpl
active, swallow
 
Constructor Summary
ObjectShaper()
           
 
Method Summary
static void addArrayAsGroup(ulu.view.View target, java.lang.reflect.Field fld, java.lang.Object obj, java.lang.String pname, java.lang.String cname, java.lang.String grp)
          expose an array field as a single child item containing all array members
static void addArrayDirectly(ulu.view.Item target, java.lang.reflect.Field fld, java.lang.Object obj, java.lang.String cname, java.lang.String grp)
          expose an array field by making each element a direct child of the target object
static void addBeanPropArrayAsGroup(ulu.view.View target, java.lang.reflect.Method getter, java.lang.Object obj, java.lang.String pname, java.lang.String cname, java.lang.String grp)
          expose a bean array field as a single child item containing all array members
static void addBeanPropArrayDirectly(ulu.view.View target, java.lang.reflect.Method getter, java.lang.Object obj, java.lang.String cname, java.lang.String grp)
          expose an array field by making each element a direct child of the target object
static void addBeanPropAsChild(ulu.view.Item target, java.lang.reflect.Method getter, java.lang.Object obj, java.lang.String name, java.lang.String grp)
          expose a non-array bean-getter (or any method that doesn't return void?) as a child item
static void addBeanPropAsProp(ulu.view.Item target, java.lang.reflect.Method getter, java.lang.reflect.Method setter, java.lang.Object obj, boolean hidden, java.lang.String name, java.lang.String grp)
          expose a non-array bean-getter as a property
static void addFieldAsChild(ulu.view.View target, java.lang.reflect.Field fld, java.lang.Object obj, java.lang.String name, java.lang.String grp)
          expose a non-array field as a child item
static void addFieldAsProp(ulu.view.Item target, java.lang.reflect.Field fld, java.lang.Object obj, boolean rw, boolean hidden, java.lang.String dispname, java.lang.String grp)
          expose a non-array field as a property
 void addInheritanceInfo(ulu.view.Item i)
          helper that adds a hidden field describing the full lineage of this object
static void addMethodAsInvokable(ulu.view.Item target, java.lang.reflect.Method meth, java.lang.Object obj, java.lang.String dispname, java.lang.String grp)
          expose a method as an invokable method of the target item
static void addMethodAsInvokable(ulu.view.Item target, java.lang.reflect.Method meth, java.lang.Object obj, java.lang.String dispname, java.lang.String grp, boolean inline)
          expose a method as an invokable method of the target item, overriding default decision as to whether result is presented inline or not
 void addNamingInfo(ulu.view.Item i)
          helper that adds in some simple class data to the Item
static java.lang.Class getBeanType(java.lang.Class raw)
          helper for getting a bean-equivalent type for a Class definition - casts primitives and other oddments
 java.lang.Object getCurrentObject(ulu.view.Item i)
          helper that gets current object, using items' reference if nothing of its own set
 MethodShaper getMethodShaper()
          get the delegate Shaper than handles reflected Methods
static java.lang.Class getNonBeanType(java.lang.Class bean)
          helper for getting a primitive class from its bean-type, reverse operation of getBeanType()
 java.lang.Object getObject()
          get the reflected object
 PropertyShaper getPropertyShaper()
          get the delegate Shaper that handles reflected Fields
static boolean isStringlike(java.lang.Class c)
          test whether this class can be represented as a simple string, i.e.
 void modify(ulu.view.Item i)
          modify an Item, according to the Shaper interface spec
 void setDefaultGroup(ulu.view.Item i, java.lang.String grpname)
          helper that sets the default group i.e.
 void setMethodShaper(MethodShaper ms)
          set the delegate Shaper than handles reflected Methods.
 void setObject(java.lang.Object obj)
          set the reflected object - if set to null, will use the object referred to by the target Item's getReference() method when modify() is invoked
 void setPropertyShaper(PropertyShaper ps)
          set the delegate Shaper than handles reflected Fields.
static java.lang.String shortName(java.lang.Class c)
          return a short name for a java Class - a convenience wrapper around shortName(String)
static java.lang.String shortName(java.lang.Object o)
          return a short name for a java Object's class - a convenience wrapper around shortName(String)
static java.lang.String shortName(java.lang.String s)
          return a short name of any dot-delimited string (such as a fully-qualified class name, e.g.
 void showStatics(boolean b)
          quick method to switch exposure of static properties and methods on or off (may be useful, but where large numbers of constants are defined, can be cluttered)
 
Methods inherited from class ulu.view.ShaperImpl
process
 
Methods inherited from class ulu.ut.ProcessorImpl
isActive, isSwallowing, setActive, setSwallowing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEMBER_GROUP_DECLARED

public static final java.lang.String MEMBER_GROUP_DECLARED
denotes the member group of fields and methods explicitly declared by this class

See Also:
Constant Field Values

MEMBER_GROUP_IMPLIED

public static final java.lang.String MEMBER_GROUP_IMPLIED
denotes the member group of fields and methods implied by ancestry of this class

See Also:
Constant Field Values

GROUPS_SHOW_ALL

public static final java.lang.String GROUPS_SHOW_ALL
special tab value denoting show all values

See Also:
Constant Field Values

obj

java.lang.Object obj
the object being exposed by this shaper


cls

java.lang.Class cls
class definition for this object


propshaper

PropertyShaper propshaper
delegate Shaper that handles reflected Fields


methshaper

MethodShaper methshaper
delegate Shaper that handles reflected Methods

Constructor Detail

ObjectShaper

public ObjectShaper()
Method Detail

getObject

public java.lang.Object getObject()
get the reflected object


setObject

public void setObject(java.lang.Object obj)
set the reflected object - if set to null, will use the object referred to by the target Item's getReference() method when modify() is invoked


getPropertyShaper

public PropertyShaper getPropertyShaper()
get the delegate Shaper that handles reflected Fields


setPropertyShaper

public void setPropertyShaper(PropertyShaper ps)
set the delegate Shaper than handles reflected Fields. Note that setting this to a different value won't alter Items already modified by the Shaper until modify() is called on them again


getMethodShaper

public MethodShaper getMethodShaper()
get the delegate Shaper than handles reflected Methods


setMethodShaper

public void setMethodShaper(MethodShaper ms)
set the delegate Shaper than handles reflected Methods. Note that setting this to a different value won't alter Items already modified by the Shaper until modify() is called on them again


showStatics

public void showStatics(boolean b)
quick method to switch exposure of static properties and methods on or off (may be useful, but where large numbers of constants are defined, can be cluttered)


modify

public void modify(ulu.view.Item i)
modify an Item, according to the Shaper interface spec


addNamingInfo

public void addNamingInfo(ulu.view.Item i)
helper that adds in some simple class data to the Item


addInheritanceInfo

public void addInheritanceInfo(ulu.view.Item i)
helper that adds a hidden field describing the full lineage of this object


setDefaultGroup

public void setDefaultGroup(ulu.view.Item i,
                            java.lang.String grpname)
helper that sets the default group i.e. the one visible when first viewed


getCurrentObject

public java.lang.Object getCurrentObject(ulu.view.Item i)
helper that gets current object, using items' reference if nothing of its own set


getBeanType

public static java.lang.Class getBeanType(java.lang.Class raw)
helper for getting a bean-equivalent type for a Class definition - casts primitives and other oddments


getNonBeanType

public static java.lang.Class getNonBeanType(java.lang.Class bean)
helper for getting a primitive class from its bean-type, reverse operation of getBeanType()


isStringlike

public static boolean isStringlike(java.lang.Class c)
test whether this class can be represented as a simple string, i.e. it can be initialised by a constructor that takes a string as sole argument


shortName

public static java.lang.String shortName(java.lang.Object o)
return a short name for a java Object's class - a convenience wrapper around shortName(String)


shortName

public static java.lang.String shortName(java.lang.Class c)
return a short name for a java Class - a convenience wrapper around shortName(String)


shortName

public static java.lang.String shortName(java.lang.String s)
return a short name of any dot-delimited string (such as a fully-qualified class name, e.g. 'java.lang.String' would return 'String')


addFieldAsProp

public static void addFieldAsProp(ulu.view.Item target,
                                  java.lang.reflect.Field fld,
                                  java.lang.Object obj,
                                  boolean rw,
                                  boolean hidden,
                                  java.lang.String dispname,
                                  java.lang.String grp)
expose a non-array field as a property


addFieldAsChild

public static void addFieldAsChild(ulu.view.View target,
                                   java.lang.reflect.Field fld,
                                   java.lang.Object obj,
                                   java.lang.String name,
                                   java.lang.String grp)
                            throws java.lang.IllegalAccessException
expose a non-array field as a child item


addArrayAsGroup

public static void addArrayAsGroup(ulu.view.View target,
                                   java.lang.reflect.Field fld,
                                   java.lang.Object obj,
                                   java.lang.String pname,
                                   java.lang.String cname,
                                   java.lang.String grp)
                            throws java.lang.IllegalAccessException
expose an array field as a single child item containing all array members


addArrayDirectly

public static void addArrayDirectly(ulu.view.Item target,
                                    java.lang.reflect.Field fld,
                                    java.lang.Object obj,
                                    java.lang.String cname,
                                    java.lang.String grp)
                             throws java.lang.IllegalAccessException
expose an array field by making each element a direct child of the target object


addMethodAsInvokable

public static void addMethodAsInvokable(ulu.view.Item target,
                                        java.lang.reflect.Method meth,
                                        java.lang.Object obj,
                                        java.lang.String dispname,
                                        java.lang.String grp)
expose a method as an invokable method of the target item


addMethodAsInvokable

public static void addMethodAsInvokable(ulu.view.Item target,
                                        java.lang.reflect.Method meth,
                                        java.lang.Object obj,
                                        java.lang.String dispname,
                                        java.lang.String grp,
                                        boolean inline)
expose a method as an invokable method of the target item, overriding default decision as to whether result is presented inline or not


addBeanPropAsProp

public static void addBeanPropAsProp(ulu.view.Item target,
                                     java.lang.reflect.Method getter,
                                     java.lang.reflect.Method setter,
                                     java.lang.Object obj,
                                     boolean hidden,
                                     java.lang.String name,
                                     java.lang.String grp)
expose a non-array bean-getter as a property


addBeanPropAsChild

public static void addBeanPropAsChild(ulu.view.Item target,
                                      java.lang.reflect.Method getter,
                                      java.lang.Object obj,
                                      java.lang.String name,
                                      java.lang.String grp)
expose a non-array bean-getter (or any method that doesn't return void?) as a child item


addBeanPropArrayAsGroup

public static void addBeanPropArrayAsGroup(ulu.view.View target,
                                           java.lang.reflect.Method getter,
                                           java.lang.Object obj,
                                           java.lang.String pname,
                                           java.lang.String cname,
                                           java.lang.String grp)
expose a bean array field as a single child item containing all array members


addBeanPropArrayDirectly

public static void addBeanPropArrayDirectly(ulu.view.View target,
                                            java.lang.reflect.Method getter,
                                            java.lang.Object obj,
                                            java.lang.String cname,
                                            java.lang.String grp)
expose an array field by making each element a direct child of the target object