com.pmease.quickbuild.variable
Class VariableWrapper

java.lang.Object
  extended by com.pmease.quickbuild.variable.VariableWrapper
All Implemented Interfaces:
java.io.Serializable

public class VariableWrapper
extends java.lang.Object
implements java.io.Serializable

Represents a variable defined in configuration. If this object is concatenated directly with other strings, the toString() method will be called implicitly. For example the string hello ${vars.get("varName").getValue()} has the same effect as hello ${vars.get("varName")}.

See Also:
Serialized Form

Nested Class Summary
static class VariableWrapper.RecordedSecretsMasker
           
 
Constructor Summary
VariableWrapper(java.lang.String name, java.lang.String value)
           
 
Method Summary
 java.lang.Object asBean()
           
 boolean asBoolean()
           
 java.util.Date asDate()
           
 int asInt()
           
 java.util.List<java.lang.String> asList()
           
static void beginSecretsRecording()
           
 int decrease()
           
 int decrease(boolean persist)
           
 boolean equals(java.lang.Object other)
           
static void finishSecretsRecording()
           
 java.lang.Object getBeanValue()
           
 boolean getBooleanValue()
           
 java.util.Date getDateValue()
           
 int getIntValue()
           
 java.util.List<java.lang.String> getListValue()
           
 java.lang.String getName()
           
static java.util.Set<java.lang.String> getRecordedSecrets()
           
 java.lang.String getSnapshot()
           
 java.lang.String getValue()
           
 int hashCode()
           
 int increase()
           
 int increase(boolean persist)
           
 boolean isDirty()
           
 boolean isEmpty()
           
 boolean isSecret()
           
static void recordSecret(java.lang.String secret)
           
static void registerAccessListener(AccessListener<VariableWrapper> listener)
           
 void setDirty(boolean dirty)
           
 void setInterpolate(boolean interpolate)
           
 void setSecret(boolean secret)
           
 void setSnapshot(java.lang.String snapshot)
           
 void setValue(boolean value)
           
 void setValue(boolean value, boolean persist)
           
 void setValue(int value)
           
 void setValue(int value, boolean persist)
           
 void setValue(java.lang.String value)
           
 void setValue(java.lang.String value, boolean persist)
           
 java.lang.String toString()
           
static void unregisterAccessListener(AccessListener<VariableWrapper> listener)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableWrapper

public VariableWrapper(java.lang.String name,
                       java.lang.String value)
Method Detail

getName

public java.lang.String getName()
Get name of the variable.


getValue

public java.lang.String getValue()
Get value of the variable. Null will be returned if the variable value is left empty.


recordSecret

public static void recordSecret(java.lang.String secret)

setValue

public void setValue(java.lang.String value)
Set variable value as specified string and persist the value into database.


getSnapshot

public java.lang.String getSnapshot()

setSnapshot

public void setSnapshot(java.lang.String snapshot)

isDirty

public boolean isDirty()

setDirty

public void setDirty(boolean dirty)

isSecret

public boolean isSecret()

setSecret

public void setSecret(boolean secret)

setInterpolate

public void setInterpolate(boolean interpolate)

setValue

public void setValue(java.lang.String value,
                     boolean persist)

isEmpty

public boolean isEmpty()
Whether or not value of the variable is empty.


increase

public int increase(boolean persist)
Increase value of the variable as integer by one, and return the original value. If the passed param is true, the increased variable value will be persisted into database.


increase

public int increase()
Increase value of the variable as integer by one, and return the original value. The increased variable will be saved into configuration.


decrease

public int decrease(boolean persist)
Decrease value of the variable as integer by one, and return the original value. If the passed param is true, the decreased variable will be persisted into database.


decrease

public int decrease()
Decrease value of the variable as integer by one, and return the original value. The decreased variable will be saved into configuration.


getIntValue

public int getIntValue()
Get variable value as integer.


asInt

public int asInt()
This method is alias of getIntValue()


getListValue

public java.util.List<java.lang.String> getListValue()
Get variable value as integer. An empty list will be returned if the variable value is null or is an empty string.


asList

public java.util.List<java.lang.String> asList()
This method is alias of getListValue()


getBeanValue

public java.lang.Object getBeanValue()
Get variable value as bean. Null will be returned if the variable value is not set.


asBean

public java.lang.Object asBean()
This method is alias of getBeanValue()


setValue

public void setValue(int value,
                     boolean persist)
Set variable value as specified integer. The second param determines whether or not to persist the value into database.


setValue

public void setValue(int value)
Set variable value as specified integer and persist the value into database.


getBooleanValue

public boolean getBooleanValue()
Get value of the variable as boolean. True will be returned if lowercase of the value equals to "true", "yes", or "y"; otherwise, false will be returned.


asBoolean

public boolean asBoolean()
This method is alias of getBooleanValue().


getDateValue

public java.util.Date getDateValue()
Get value of the variable as date. Null will be returned if the value is not set.


asDate

public java.util.Date asDate()
This method is alias of getDateValue().


setValue

public void setValue(boolean value)
Set value of the variable as specified boolean and persist it into database.


setValue

public void setValue(boolean value,
                     boolean persist)
Set variable value as specified boolean. The second param determines whether or not to persist the value into database.


getRecordedSecrets

public static java.util.Set<java.lang.String> getRecordedSecrets()

beginSecretsRecording

public static void beginSecretsRecording()

finishSecretsRecording

public static void finishSecretsRecording()

toString

public java.lang.String toString()
Get string representation of the variable value. This returns the same as method getValue().

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

registerAccessListener

public static void registerAccessListener(AccessListener<VariableWrapper> listener)

unregisterAccessListener

public static void unregisterAccessListener(AccessListener<VariableWrapper> listener)


Copyright © 2005-2010 PMEase Inc. All Rights Reserved.