com.amazon.carbonado.synthetic
Class SyntheticProperty

java.lang.Object
  extended by com.amazon.carbonado.synthetic.SyntheticProperty
All Implemented Interfaces:
Comparable<SyntheticProperty>

public class SyntheticProperty
extends Object
implements Comparable<SyntheticProperty>

Minimal specification of a storable property for use with a SyntheticStorableBuilder. Synthetic storables can be used to generate user storables.

Author:
Don Schneider, Brian S O'Neill

Constructor Summary
SyntheticProperty(String name, Class type)
          Every property requires minimally a name and a type
SyntheticProperty(String name, Class type, boolean isNullable, boolean isVersion)
           
 
Method Summary
 void addAccessorAnnotationDescriptor(String annotationDesc)
          Add an arbitrary annotation to the property accessor method, as specified by a descriptor.
 int compareTo(SyntheticProperty otherProp)
          Comparable implementation.
 boolean equals(Object o)
           
 List<String> getAccessorAnnotationDescriptors()
          Returns all the added accessor annotation descriptors in an unmodifiable list.
 StorablePropertyAdapter getAdapter()
           
 String getName()
           
 String getReadMethodName()
          Returns the name of the read method.
 Class getType()
           
 String getWriteMethodName()
          Returns the name of the write method.
 int hashCode()
           
 boolean isNullable()
           
 boolean isVersion()
           
static String makeReadMethodName(String name, Class type)
          Generate a name for a bean "get" method ("is" method, for booleans).
static String makeWriteMethodName(String name)
          Generate a name for a bean "set" method
 void setAdapter(StorablePropertyAdapter adapter)
          Storables cannot currently have more than one adapter per property.
 void setIsNullable(boolean isNullable)
           
 void setIsVersion(boolean isVersion)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SyntheticProperty

public SyntheticProperty(String name,
                         Class type)
Every property requires minimally a name and a type

Parameters:
name - for the property
type - of the data it contains

SyntheticProperty

public SyntheticProperty(String name,
                         Class type,
                         boolean isNullable,
                         boolean isVersion)
Parameters:
name - property name
type - property type
isNullable - true if this property can be null (default false)
isVersion - true if this property is a version number (default false)
Method Detail

makeReadMethodName

public static String makeReadMethodName(String name,
                                        Class type)
Generate a name for a bean "get" method ("is" method, for booleans).

Parameters:
name - of the property
type - return type of the property
See Also:
getReadMethodName()

makeWriteMethodName

public static String makeWriteMethodName(String name)
Generate a name for a bean "set" method

Parameters:
name - of the property
See Also:
getWriteMethodName()

getName

public String getName()
Returns:
Name of the property

getType

public Class getType()
Returns:
type of the property

isNullable

public boolean isNullable()
Returns:
true if the property can be null

setIsNullable

public void setIsNullable(boolean isNullable)
Parameters:
isNullable - true if the property can be null

isVersion

public boolean isVersion()
Returns:
true if the property contains the versioning information for the storable. Note that at most one property can be the version property for a given storable

setIsVersion

public void setIsVersion(boolean isVersion)
Parameters:
isVersion - true if the property should contain the versioning information for the storable

getReadMethodName

public String getReadMethodName()
Returns the name of the read method.


getWriteMethodName

public String getWriteMethodName()
Returns the name of the write method.


getAdapter

public StorablePropertyAdapter getAdapter()
Returns:
the optional adapter.

setAdapter

public void setAdapter(StorablePropertyAdapter adapter)
Storables cannot currently have more than one adapter per property.

Parameters:
adapter - The adapter to set.

addAccessorAnnotationDescriptor

public void addAccessorAnnotationDescriptor(String annotationDesc)
Add an arbitrary annotation to the property accessor method, as specified by a descriptor.

See Also:
AnnotationDescPrinter

getAccessorAnnotationDescriptors

public List<String> getAccessorAnnotationDescriptors()
Returns all the added accessor annotation descriptors in an unmodifiable list.


compareTo

public int compareTo(SyntheticProperty otherProp)
Comparable implementation.

Specified by:
compareTo in interface Comparable<SyntheticProperty>
Parameters:
otherProp -

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.