BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.context.AttributeItem Class Reference
Collaboration diagram for org.turro.elephant.impl.context.AttributeItem:

Public Member Functions

 AttributeItem (String name, Boolean value, Boolean defaultValue)
 
 AttributeItem (String name, Number value, Number defaultValue)
 
 AttributeItem (String name, Date value, Date defaultValue)
 
 AttributeItem (String name, String value, int type, String defaultValue)
 
void addChoice (String choice)
 
String getValue ()
 
String getValue (String defaultValue)
 
void setValue (String value)
 
double getDoubleValue ()
 
double getDoubleValue (double defaultValue)
 
int getIntegerValue ()
 
int getIntegerValue (int defaultValue)
 
long getLongValue ()
 
long getLongValue (long defaultValue)
 
boolean getBooleanValue ()
 
boolean getBooleanValue (boolean defaultValue)
 
void setBooleanValue (boolean value)
 
Date getDateValue ()
 
Date getDateValue (Date defaultValue)
 
List getChoices ()
 

Static Public Member Functions

static AttributeItem getFromParameter (IConstructor constructor, String name, String defaultValue)
 

Public Attributes

String name
 
int type
 
List choices = null
 

Static Public Attributes

static final int STRING_ATTR = 0
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 34 of file AttributeItem.java.

Constructor & Destructor Documentation

◆ AttributeItem() [1/4]

org.turro.elephant.impl.context.AttributeItem.AttributeItem ( String  name,
Boolean  value,
Boolean  defaultValue 
)

Creates a new instance of AttributeItem

Definition at line 47 of file AttributeItem.java.

47  {
48  this(name,
49  value.booleanValue() ? "true" : "false",
50  NUMBER_ATTR,
51  defaultValue.booleanValue() ? "true" : "false");
52  }

◆ AttributeItem() [2/4]

org.turro.elephant.impl.context.AttributeItem.AttributeItem ( String  name,
Number  value,
Number  defaultValue 
)

Creates a new instance of AttributeItem

Definition at line 55 of file AttributeItem.java.

55  {
56  this(name,
57  ObjectString.formatNativeObject(value, true),
58  NUMBER_ATTR,
59  ObjectString.formatNativeObject(defaultValue, true));
60  }

◆ AttributeItem() [3/4]

org.turro.elephant.impl.context.AttributeItem.AttributeItem ( String  name,
Date  value,
Date  defaultValue 
)

Creates a new instance of AttributeItem

Definition at line 63 of file AttributeItem.java.

63  {
64  this(name,
65  ObjectString.formatObject(value, ObjectString.COMPRESSED_DATE_PATTERN, true),
66  DATE_ATTR,
67  ObjectString.formatObject(defaultValue, ObjectString.COMPRESSED_DATE_PATTERN, true));
68  }

◆ AttributeItem() [4/4]

org.turro.elephant.impl.context.AttributeItem.AttributeItem ( String  name,
String  value,
int  type,
String  defaultValue 
)

Creates a new instance of AttributeItem

Definition at line 71 of file AttributeItem.java.

71  {
72  this.name = name;
73  this.value = value;
74  this.type = type;
75  this.defaultValue = defaultValue;
76  }

Member Function Documentation

◆ addChoice()

void org.turro.elephant.impl.context.AttributeItem.addChoice ( String  choice)

Definition at line 78 of file AttributeItem.java.

78  {
79  if(choices == null)
80  choices = new ArrayList();
81  choices.add(choice);
82  type = SELECT_ATTR;
83  }

◆ getBooleanValue() [1/2]

boolean org.turro.elephant.impl.context.AttributeItem.getBooleanValue ( )

Definition at line 132 of file AttributeItem.java.

132  {
133  String v = getValue();
134  return "true".equals(v);
135  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBooleanValue() [2/2]

boolean org.turro.elephant.impl.context.AttributeItem.getBooleanValue ( boolean  defaultValue)

Definition at line 137 of file AttributeItem.java.

137  {
138  if(value == null) {
139  return defaultValue;
140  }
141  return getBooleanValue();
142  }
Here is the call graph for this function:

◆ getChoices()

List org.turro.elephant.impl.context.AttributeItem.getChoices ( )

Definition at line 160 of file AttributeItem.java.

160  {
161  return choices;
162  }

◆ getDateValue() [1/2]

Date org.turro.elephant.impl.context.AttributeItem.getDateValue ( )

Definition at line 148 of file AttributeItem.java.

148  {
149  String v = getValue();
150  return (Date) ObjectString.parseString(v, ObjectString.COMPRESSED_DATE_PATTERN, Date.class, false);
151  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDateValue() [2/2]

Date org.turro.elephant.impl.context.AttributeItem.getDateValue ( Date  defaultValue)

Definition at line 153 of file AttributeItem.java.

153  {
154  if(value == null) {
155  return defaultValue;
156  }
157  return getDateValue();
158  }
Here is the call graph for this function:

◆ getDoubleValue() [1/2]

double org.turro.elephant.impl.context.AttributeItem.getDoubleValue ( )

Definition at line 99 of file AttributeItem.java.

99  {
100  return ((Double) ObjectString.parseNativeString(getValue(), Double.class, true)).doubleValue();
101  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDoubleValue() [2/2]

double org.turro.elephant.impl.context.AttributeItem.getDoubleValue ( double  defaultValue)

Definition at line 103 of file AttributeItem.java.

103  {
104  if(value == null) {
105  return defaultValue;
106  }
107  return getDoubleValue();
108  }
Here is the call graph for this function:

◆ getFromParameter()

static AttributeItem org.turro.elephant.impl.context.AttributeItem.getFromParameter ( IConstructor  constructor,
String  name,
String  defaultValue 
)
static

Definition at line 176 of file AttributeItem.java.

176  {
177  String[] values = constructor.getParameterValues(name);
178  return new AttributeItem(name, format(values), STRING_ATTR, defaultValue);
179  }
AttributeItem(String name, Boolean value, Boolean defaultValue)
Here is the caller graph for this function:

◆ getIntegerValue() [1/2]

int org.turro.elephant.impl.context.AttributeItem.getIntegerValue ( )

Definition at line 110 of file AttributeItem.java.

110  {
111  return ((Integer) ObjectString.parseNativeString(getValue(), Integer.class, true)).intValue();
112  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIntegerValue() [2/2]

int org.turro.elephant.impl.context.AttributeItem.getIntegerValue ( int  defaultValue)

Definition at line 114 of file AttributeItem.java.

114  {
115  if(value == null) {
116  return defaultValue;
117  }
118  return getIntegerValue();
119  }
Here is the call graph for this function:

◆ getLongValue() [1/2]

long org.turro.elephant.impl.context.AttributeItem.getLongValue ( )

Definition at line 121 of file AttributeItem.java.

121  {
122  return ((Long) ObjectString.parseNativeString(getValue(), Long.class, true)).longValue();
123  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLongValue() [2/2]

long org.turro.elephant.impl.context.AttributeItem.getLongValue ( long  defaultValue)

Definition at line 125 of file AttributeItem.java.

125  {
126  if(value == null) {
127  return defaultValue;
128  }
129  return getLongValue();
130  }
Here is the call graph for this function:

◆ getValue() [1/2]

String org.turro.elephant.impl.context.AttributeItem.getValue ( )

Definition at line 85 of file AttributeItem.java.

85  {
86  if(value == null) return defaultValue;
87  return value;
88  }
Here is the caller graph for this function:

◆ getValue() [2/2]

String org.turro.elephant.impl.context.AttributeItem.getValue ( String  defaultValue)

Definition at line 90 of file AttributeItem.java.

90  {
91  if(value == null) return defaultValue;
92  return value;
93  }

◆ setBooleanValue()

void org.turro.elephant.impl.context.AttributeItem.setBooleanValue ( boolean  value)

Definition at line 144 of file AttributeItem.java.

144  {
145  this.value = value ? "true" : "false";
146  }
Here is the caller graph for this function:

◆ setValue()

void org.turro.elephant.impl.context.AttributeItem.setValue ( String  value)

Definition at line 95 of file AttributeItem.java.

95  {
96  this.value = value;
97  }
Here is the caller graph for this function:

Member Data Documentation

◆ choices

List org.turro.elephant.impl.context.AttributeItem.choices = null

Definition at line 44 of file AttributeItem.java.

◆ name

String org.turro.elephant.impl.context.AttributeItem.name

Definition at line 42 of file AttributeItem.java.

◆ STRING_ATTR

final int org.turro.elephant.impl.context.AttributeItem.STRING_ATTR = 0
static

Definition at line 36 of file AttributeItem.java.

◆ type

int org.turro.elephant.impl.context.AttributeItem.type

Definition at line 43 of file AttributeItem.java.


The documentation for this class was generated from the following file: