com.univocity.api.entity
Class DefaultEntityField

java.lang.Object
  extended by com.univocity.api.entity.DefaultEntityField

public class DefaultEntityField
extends Object

Provides basic information for a data entity field.

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Constructor Summary
DefaultEntityField(String name)
          Creates an entity field instance with its name.
 
Method Summary
 Object getDefaultValue()
          Obtains a default value to use when the value of this field is null.
 int getLength()
          Obtains the maximum length of this field.
 String getName()
          Obtains the name that describes a particular field in each record of an entity.
 Class<?> getType()
          Obtains the type of values stored by this field.
 boolean isGenerated()
          Indicates whether values for this field are generated automatically.
 boolean isIdentifier()
          Indicates this field is part of the identifier of a record.
 boolean isNullable()
          Indicates whether this field can store null values.
 void setDefaultValue(Object defaultValue)
          Defines a default value to use when the value of this field is null.
 void setGenerated(boolean isGenerated)
          Updates the indication that values for this field are generated automatically.
 void setIdentifier(boolean isIdentifier)
          Defines this field as an identifier (or part of an identifier) of records produced by a data entity.
 void setLength(int length)
          Defines the maximum length of this field.
 void setNullable(boolean isNullable)
          Defines whether this field can store null values.
 void setType(Class<?> type)
          Defines the type of values stored by this field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEntityField

public DefaultEntityField(String name)
Creates an entity field instance with its name.

Parameters:
name - a name that describes a particular field in each record of an entity.
Method Detail

getName

public String getName()
Obtains the name that describes a particular field in each record of an entity.

Returns:
the field name

isGenerated

public boolean isGenerated()
Indicates whether values for this field are generated automatically.

Returns:
true if values of this field are generated automatically; false otherwise

isIdentifier

public boolean isIdentifier()
Indicates this field is part of the identifier of a record.

Returns:
true if this field is part of the identifier of a record; false otherwise

isNullable

public boolean isNullable()
Indicates whether this field can store null values.

Returns:
true if this field accepts null values; false otherwise

getDefaultValue

public Object getDefaultValue()
Obtains a default value to use when the value of this field is null.

Returns:
the default value of this field.

setIdentifier

public void setIdentifier(boolean isIdentifier)
Defines this field as an identifier (or part of an identifier) of records produced by a data entity.

Parameters:
isIdentifier - a flag indicating this field is part of the identifiers of a data entity.

setNullable

public void setNullable(boolean isNullable)
Defines whether this field can store null values.

Parameters:
isNullable - a flag indicating whether this field accepts null values.

setDefaultValue

public void setDefaultValue(Object defaultValue)
Defines a default value to use when the value of this field is null.

Parameters:
defaultValue - the default value of this field.

setGenerated

public void setGenerated(boolean isGenerated)
Updates the indication that values for this field are generated automatically.

Parameters:
isGenerated - a flag indicating values for this field are generated automatically.

getLength

public int getLength()
Obtains the maximum length of this field. A value of -1 means the length is undefined.

defaults to -1

Returns:
the length of this field.

setLength

public void setLength(int length)
Defines the maximum length of this field. A value of -1 means the length is undefined. Zero is not a valid length.

Parameters:
length - the length of this field.

getType

public Class<?> getType()
Obtains the type of values stored by this field. If defined, uniVocity will try to convert values before writing to this field.

defaults to null

Returns:
the type of values stored by this field.

setType

public void setType(Class<?> type)
Defines the type of values stored by this field. uniVocity will try to convert values before writing to this field.

Parameters:
type - the type of values stored by this field.


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.