org.omnaest.utils.propertyfile.content
Class PropertyFileContent

java.lang.Object
  extended by org.omnaest.utils.propertyfile.content.PropertyFileContent

public class PropertyFileContent
extends Object

Author:
Omnaest

Field Summary
protected  List<Element> elementList
           
protected  IndexManager indexManager
           
protected  String lineSeparator
           
 
Constructor Summary
PropertyFileContent()
           
 
Method Summary
 void appendElement(Element element)
           
 void clear()
          Clears all Element instances from this PropertyFileContent instance.
 Element getElementByIndexPosition(int index)
          Returns the element at the given index position.
 List<Element> getElementList()
          Gets a new list instance of all Elements managed by this PropertyFileContent instance.
 List<Element> getElementListAscendingByIndexPosition()
          Returns a new list instance of all Elements managed by this PropertyFileContent instance sorted in ascending order by their index position (which has the same order as the line numbers).
 String getLineSeparator()
           
 List<Property> getPropertyList()
          Returns a new list instance containing all Property instances.
 PropertyMap getPropertyMap()
          Returns a PropertyMap view on the Property elements of this PropertyFileContent instance.
 boolean hasProperty(Property property)
          Returns true if the same Property is present.
 boolean hasPropertyKey(String propertyKey)
          Returns true if a Property with the given key exists.
 boolean hasPropertyKeyAndValueList(String propertyKey, List<String> propertyValueList)
          Returns true if a Property with the given key exists.
 boolean hasPropertyWithSameKeyAndValue(Property property)
          Returns true if the same Property is present.
 void insertElementAfter(Element element, Element elementBefore)
           
 void removeElement(Element element)
           
 void replaceElement(Element elementOld, Element elementNew)
          Replaces an old Element by a new Element.
 void setLineSeparator(String lineSeparator)
           
 int size()
          Returns the number of Elements.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

elementList

protected List<Element> elementList

indexManager

protected IndexManager indexManager

lineSeparator

protected String lineSeparator
Constructor Detail

PropertyFileContent

public PropertyFileContent()
Method Detail

getElementList

public List<Element> getElementList()
Gets a new list instance of all Elements managed by this PropertyFileContent instance.


getElementListAscendingByIndexPosition

public List<Element> getElementListAscendingByIndexPosition()
Returns a new list instance of all Elements managed by this PropertyFileContent instance sorted in ascending order by their index position (which has the same order as the line numbers).

Returns:

getPropertyList

public List<Property> getPropertyList()
Returns a new list instance containing all Property instances.

Returns:

appendElement

public void appendElement(Element element)

insertElementAfter

public void insertElementAfter(Element element,
                               Element elementBefore)

size

public int size()
Returns the number of Elements.

Returns:

getElementByIndexPosition

public Element getElementByIndexPosition(int index)
Returns the element at the given index position. Index positions starts with index 0.

Parameters:
index -
Returns:

removeElement

public void removeElement(Element element)

clear

public void clear()
Clears all Element instances from this PropertyFileContent instance.


replaceElement

public void replaceElement(Element elementOld,
                           Element elementNew)
Replaces an old Element by a new Element. The new Element will have the same Index / line position as the old Element before.

Parameters:
elementOld -
elementNew -

getPropertyMap

public PropertyMap getPropertyMap()
Returns a PropertyMap view on the Property elements of this PropertyFileContent instance. The map is backed by the PropertyFileContent and modifications to it will modify the PropertyFileContent, too, and vice versa.

Returns:
See Also:
PropertyMap

hasPropertyKey

public boolean hasPropertyKey(String propertyKey)
Returns true if a Property with the given key exists.

Parameters:
propertyKey -
Returns:

hasPropertyKeyAndValueList

public boolean hasPropertyKeyAndValueList(String propertyKey,
                                          List<String> propertyValueList)
Returns true if a Property with the given key exists.

Parameters:
propertyKey -
propertyValueList -
Returns:

hasProperty

public boolean hasProperty(Property property)
Returns true if the same Property is present. Uses Property.equals(Object) comparison.

Parameters:
property -
Returns:
See Also:
hasProperty(Property)

hasPropertyWithSameKeyAndValue

public boolean hasPropertyWithSameKeyAndValue(Property property)
Returns true if the same Property is present. Uses Property.equalsInKeyAndValue(Object) comparison.

Parameters:
property -
Returns:
See Also:
hasPropertyKey(String)

getLineSeparator

public String getLineSeparator()

setLineSeparator

public void setLineSeparator(String lineSeparator)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.