asia.redact.bracket.properties
Class PropertiesParser

java.lang.Object
  extended by asia.redact.bracket.properties.PropertiesParser

public class PropertiesParser
extends Object

 Populate a Properties object. Parser is a thread-safe one use object. The list of
 tokens normally is the output of a PropertiesLexer but can be generated in other ways,
 for example manually.
 
 

Author:
Dave
See Also:
PropertiesLexer

Field Summary
private  Lock lock
           
(package private)  Properties properties
           
(package private)  Stack<PropertiesToken> tokens
           
private  boolean trimValues
           
 
Constructor Summary
PropertiesParser(List<PropertiesToken> tokens)
          This constructor expects the tokens to be in parse order, it reverses the order as it pushes them onto the stack (so the stack order is backwards to the parse).
PropertiesParser(List<PropertiesToken> tokens, Properties properties)
           
PropertiesParser(Stack<PropertiesToken> tokens)
          This constructor expects the tokens to be in reverse parse order, it uses the stack as-is (the stack order is backwards to the parse order).
 
Method Summary
 Properties getProperties()
           
 boolean isTrimValues()
           
 void parse()
           
private  PropertiesToken peek()
           
private  PropertiesToken pop()
           
 void setTrimValues(boolean trimValues)
           
private  String trimEndingWhiteSpace(String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

final Stack<PropertiesToken> tokens

properties

final Properties properties

lock

private final Lock lock

trimValues

private boolean trimValues
Constructor Detail

PropertiesParser

public PropertiesParser(List<PropertiesToken> tokens,
                        Properties properties)

PropertiesParser

public PropertiesParser(List<PropertiesToken> tokens)
This constructor expects the tokens to be in parse order, it reverses the order as it pushes them onto the stack (so the stack order is backwards to the parse).

Parameters:
tokens -

PropertiesParser

public PropertiesParser(Stack<PropertiesToken> tokens)
This constructor expects the tokens to be in reverse parse order, it uses the stack as-is (the stack order is backwards to the parse order).

Parameters:
tokens -
Method Detail

parse

public void parse()

peek

private PropertiesToken peek()

pop

private PropertiesToken pop()

getProperties

public Properties getProperties()

isTrimValues

public boolean isTrimValues()

setTrimValues

public void setTrimValues(boolean trimValues)

trimEndingWhiteSpace

private String trimEndingWhiteSpace(String text)


Copyright © 2011-2013 David R. Smith. All Rights Reserved.