org.drools.factmodel
Class FieldDefinition

java.lang.Object
  extended by org.drools.factmodel.FieldDefinition
All Implemented Interfaces:
Externalizable, Serializable, Comparable<FieldDefinition>, org.drools.definition.type.FactField

public class FieldDefinition
extends Object
implements org.drools.definition.type.FactField, Comparable<FieldDefinition>

Declares a field to be dynamically generated.

See Also:
Serialized Form

Constructor Summary
FieldDefinition()
           
FieldDefinition(String name, String type)
          Default constructor
FieldDefinition(String name, String type, boolean key)
          Default constructor
 
Method Summary
 int compareTo(FieldDefinition other)
           
 boolean equals(Object o)
           
 Object get(Object bean)
           
 boolean getDefaultValueAs_boolean()
           
 byte getDefaultValueAs_byte()
           
 char getDefaultValueAs_char()
           
 double getDefaultValueAs_double()
           
 float getDefaultValueAs_float()
           
 int getDefaultValueAs_int()
           
 long getDefaultValueAs_long()
           
 short getDefaultValueAs_short()
           
 Boolean getDefaultValueAsBoolean()
           
 Byte getDefaultValueAsByte()
           
 Character getDefaultValueAsChar()
           
 Double getDefaultValueAsDouble()
           
 Float getDefaultValueAsFloat()
           
 Integer getDefaultValueAsInt()
           
 Long getDefaultValueAsLong()
           
 Short getDefaultValueAsShort()
           
 String getDefaultValueAsString()
           
 ClassFieldAccessor getFieldAccessor()
           
 int getIndex()
           
 String getInitExpr()
           
 String getName()
           
 String getReadMethod()
          Creates the String name for the get method for a field with the given name and type
 Class<?> getType()
           
 String getTypeName()
           
 Object getValue(Object bean)
          Returns the value of this attribute in the target bean instance
 String getWriteMethod()
          Creates the String name for the set method for a field with the given name and type
 int hashCode()
           
 boolean isInherited()
           
 boolean isKey()
           
 void readExternal(ObjectInput in)
           
 void set(Object bean, Object value)
           
 void setIndex(int index)
           
 void setInherited(boolean inherited)
           
 void setInitExpr(String initExpr)
           
 void setKey(boolean key)
           
 void setName(String name)
           
 void setReadWriteAccessor(ClassFieldAccessor accessor)
           
 void setTypeName(String type)
           
 void setValue(Object bean, Object value)
          Sets the value of this attribute in the target bean instance
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldDefinition

public FieldDefinition()

FieldDefinition

public FieldDefinition(String name,
                       String type)
Default constructor

Parameters:
name - the field's name
type - the fully qualified fields type

FieldDefinition

public FieldDefinition(String name,
                       String type,
                       boolean key)
Default constructor

Parameters:
name - the field's name
type - the fully qualified fields type
Method Detail

setReadWriteAccessor

public void setReadWriteAccessor(ClassFieldAccessor accessor)

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

getName

public String getName()
Specified by:
getName in interface org.drools.definition.type.FactField
Returns:
Returns the name.

setName

public void setName(String name)
Parameters:
name - The name to set.

getTypeName

public String getTypeName()
Returns:
Returns the fully qualified type.

setTypeName

public void setTypeName(String type)
Parameters:
type - The fully qualified type to set.

getType

public Class<?> getType()
Specified by:
getType in interface org.drools.definition.type.FactField

isKey

public boolean isKey()
Specified by:
isKey in interface org.drools.definition.type.FactField
Returns:
Returns the key.

setKey

public void setKey(boolean key)
Parameters:
key - The key to set.

getReadMethod

public String getReadMethod()
Creates the String name for the get method for a field with the given name and type

Returns:

getWriteMethod

public String getWriteMethod()
Creates the String name for the set method for a field with the given name and type

Returns:

equals

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

getFieldAccessor

public ClassFieldAccessor getFieldAccessor()
Returns:
Returns the field extractor

hashCode

public int hashCode()
Overrides:
hashCode in class Object

setValue

public void setValue(Object bean,
                     Object value)
Sets the value of this attribute in the target bean instance

Parameters:
bean - the target bean instance where the attribute shall be set
value - the value to set the attribute to

getValue

public Object getValue(Object bean)
Returns the value of this attribute in the target bean instance

Parameters:
bean - the target bean instance
Returns:
target bean instance attribute value

get

public Object get(Object bean)
Specified by:
get in interface org.drools.definition.type.FactField

set

public void set(Object bean,
                Object value)
Specified by:
set in interface org.drools.definition.type.FactField

isInherited

public boolean isInherited()

setInherited

public void setInherited(boolean inherited)

getIndex

public int getIndex()
Specified by:
getIndex in interface org.drools.definition.type.FactField

setIndex

public void setIndex(int index)

getInitExpr

public String getInitExpr()

setInitExpr

public void setInitExpr(String initExpr)

compareTo

public int compareTo(FieldDefinition other)
Specified by:
compareTo in interface Comparable<FieldDefinition>

getDefaultValueAsString

public String getDefaultValueAsString()

getDefaultValueAsBoolean

public Boolean getDefaultValueAsBoolean()

getDefaultValueAsByte

public Byte getDefaultValueAsByte()

getDefaultValueAsChar

public Character getDefaultValueAsChar()

getDefaultValueAsDouble

public Double getDefaultValueAsDouble()

getDefaultValueAsFloat

public Float getDefaultValueAsFloat()

getDefaultValueAsInt

public Integer getDefaultValueAsInt()

getDefaultValueAsLong

public Long getDefaultValueAsLong()

getDefaultValueAsShort

public Short getDefaultValueAsShort()

getDefaultValueAs_boolean

public boolean getDefaultValueAs_boolean()

getDefaultValueAs_byte

public byte getDefaultValueAs_byte()

getDefaultValueAs_char

public char getDefaultValueAs_char()

getDefaultValueAs_double

public double getDefaultValueAs_double()

getDefaultValueAs_float

public float getDefaultValueAs_float()

getDefaultValueAs_int

public int getDefaultValueAs_int()

getDefaultValueAs_long

public long getDefaultValueAs_long()

getDefaultValueAs_short

public short getDefaultValueAs_short()


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.