net.stickycode.coercion.target
Class AbstractCoercionTarget

java.lang.Object
  extended by net.stickycode.coercion.target.AbstractCoercionTarget
All Implemented Interfaces:
CoercionTarget
Direct Known Subclasses:
ArrayCoercionTarget, ParameterizedCoercionTarget, PrimitiveResolvingCoercionTarget

public abstract class AbstractCoercionTarget
extends Object
implements CoercionTarget


Field Summary
protected  Class<?> owner
           
protected  CoercionTarget parent
           
protected  Class<?> type
           
 
Constructor Summary
AbstractCoercionTarget(Class<?> type, Class<?> owner, CoercionTarget parent, String name)
           
 
Method Summary
 Class<?> boxedType()
          If this target represents a primitive type return the boxing type for it
 boolean canBeAnnotated()
           
 AnnotatedElement getAnnotatedElement()
           
 CoercionTarget[] getComponentCoercionTypes()
          Return the CoercionTargets for the components.
 String getName()
           
 Class<?> getOwner()
          Return the owning type of the target, for a method this is the class the method was found on similarly for fields.
 CoercionTarget getParent()
           
 Class<?> getType()
          Return the type for the target to be coerced
 boolean hasComponents()
          Does the target have components, this is true of any container e.g.
 boolean hasParent()
           
 boolean isArray()
          Is the underlying target an array
 boolean isPrimitive()
          Return true if this target is a primitive type
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected final Class<?> type

owner

protected final Class<?> owner

parent

protected final CoercionTarget parent
Constructor Detail

AbstractCoercionTarget

public AbstractCoercionTarget(Class<?> type,
                              Class<?> owner,
                              CoercionTarget parent,
                              String name)
Method Detail

getType

public Class<?> getType()
Description copied from interface: CoercionTarget
Return the type for the target to be coerced

Specified by:
getType in interface CoercionTarget

isArray

public boolean isArray()
Description copied from interface: CoercionTarget
Is the underlying target an array

Specified by:
isArray in interface CoercionTarget

hasComponents

public boolean hasComponents()
Description copied from interface: CoercionTarget
Does the target have components, this is true of any container e.g. Collection, Map

Specified by:
hasComponents in interface CoercionTarget

getComponentCoercionTypes

public CoercionTarget[] getComponentCoercionTypes()
Description copied from interface: CoercionTarget
Return the CoercionTargets for the components. For a collection this would return a single CoercionTarget for the element contained. For a map you would get one for the key and one for the value.

Specified by:
getComponentCoercionTypes in interface CoercionTarget

isPrimitive

public boolean isPrimitive()
Description copied from interface: CoercionTarget
Return true if this target is a primitive type

Specified by:
isPrimitive in interface CoercionTarget

boxedType

public Class<?> boxedType()
Description copied from interface: CoercionTarget
If this target represents a primitive type return the boxing type for it

Specified by:
boxedType in interface CoercionTarget

canBeAnnotated

public boolean canBeAnnotated()
Specified by:
canBeAnnotated in interface CoercionTarget

getAnnotatedElement

public AnnotatedElement getAnnotatedElement()
Specified by:
getAnnotatedElement in interface CoercionTarget

getOwner

public Class<?> getOwner()
Description copied from interface: CoercionTarget
Return the owning type of the target, for a method this is the class the method was found on similarly for fields.

Specified by:
getOwner in interface CoercionTarget

getParent

public CoercionTarget getParent()
Specified by:
getParent in interface CoercionTarget

hasParent

public boolean hasParent()
Specified by:
hasParent in interface CoercionTarget

toString

public String toString()
Overrides:
toString in class Object

getName

public String getName()
Specified by:
getName in interface CoercionTarget


Copyright © 2003-2012 RedEngine Ltd. All Rights Reserved.