de.enough.polish
Class Attribute

java.lang.Object
  extended by de.enough.polish.Variable
      extended by de.enough.polish.Attribute

public class Attribute
extends Variable

Represents a JAD or MANIFEST attribute.

Copyright Enough Software 2004 - 2011

 history
        29-Aug-2004 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
 
Fields inherited from class de.enough.polish.Variable
fileName
 
Constructor Summary
Attribute()
          Creates a new uninitalised attribute
Attribute(Attribute attribute)
          Copies are setings from the given attribute
Attribute(String name, String value)
          Creates a new initialised attribute.
 
Method Summary
protected  Variable[] createArray(int size)
           
 Variable createVariable(String varName, String varValue)
           
protected  char getDelimiter()
          The delimiter for separating variable-names from variable-values.
protected  String getFileIOError(File file, IOException e)
          Gets the error-message that is shown when a variables file could not be loaded.
protected  String getFileNotFoundError(File file)
          Gets the error-message that is shown when a static variables file could not be found.
protected  String getFileNotFoundWarning(File file)
          Gets the warning that is shown when a dynamic variables file could not be found.
 Attribute[] loadAttributes(Environment environment)
          Loads all attribute-definitions from the specified file.
 void setTarget(String targetStr)
          Sets the target for this attribute.
 void setTargetsJad(boolean targets)
          Defines if this attribute targets the jad.
 void setTargetsManifest(boolean targets)
          Defines if this attribute targets the manifest.
 boolean targetsJad()
           
 boolean targetsManifest()
           
 
Methods inherited from class de.enough.polish.Variable
containsMultipleVariables, getFile, getIfCondition, getName, getType, getUnlessCondition, getValue, hasCondition, isConditionFulfilled, isConditionFulfilled, loadVariables, setFile, setIf, setName, setType, setUnless, setValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute()
Creates a new uninitalised attribute


Attribute

public Attribute(Attribute attribute)
Copies are setings from the given attribute

Parameters:
attribute - the original attribute

Attribute

public Attribute(String name,
                 String value)
Creates a new initialised attribute.

Parameters:
name - the name of the attribute
value - the value of the attribute
Method Detail

setTarget

public void setTarget(String targetStr)
Sets the target for this attribute.

Parameters:
targetStr - the target, either "jad" or "manifest" or both separated by comma.

targetsJad

public boolean targetsJad()
Returns:
Returns true when this attribute should be added to the JAD.

targetsManifest

public boolean targetsManifest()
Returns:
Returns true when this attribute should be added to the MANIFEST.

loadAttributes

public Attribute[] loadAttributes(Environment environment)
Loads all attribute-definitions from the specified file.

Parameters:
environment - the environment settings
Returns:
an array of variable definitions found in the specified file.

getFileNotFoundWarning

protected String getFileNotFoundWarning(File file)
Gets the warning that is shown when a dynamic variables file could not be found.

Overrides:
getFileNotFoundWarning in class Variable
Parameters:
file - the file that couldn't be found
Returns:
a warning message

getFileNotFoundError

protected String getFileNotFoundError(File file)
Gets the error-message that is shown when a static variables file could not be found.

Overrides:
getFileNotFoundError in class Variable
Parameters:
file - the file that couldn't be found
Returns:
an error message

getFileIOError

protected String getFileIOError(File file,
                                IOException e)
Gets the error-message that is shown when a variables file could not be loaded.

Overrides:
getFileIOError in class Variable
Parameters:
file - the file that couldn't be found
e - the IOException
Returns:
an error message

setTargetsManifest

public void setTargetsManifest(boolean targets)
Defines if this attribute targets the manifest.

Parameters:
targets - true when this attribute targets the manifest.

setTargetsJad

public void setTargetsJad(boolean targets)
Defines if this attribute targets the jad.

Parameters:
targets - true when this attribute targets the jad.

getDelimiter

protected char getDelimiter()
The delimiter for separating variable-names from variable-values.

Overrides:
getDelimiter in class Variable
Returns:
':' by default

createArray

protected Variable[] createArray(int size)
Overrides:
createArray in class Variable

createVariable

public Variable createVariable(String varName,
                               String varValue)
Overrides:
createVariable in class Variable