Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * $Id: Entry.java 130 2009-06-05 17:01:24Z karianna $
   * $URL: https://ikasaneip.svn.sourceforge.net/svnroot/ikasaneip/tags/ikasan-0.7.3/common/src/main/java/org/ikasan/common/configuration/Entry.java $
   * 
   * ====================================================================
   * Ikasan Enterprise Integration Platform
   * Copyright (c) 2003-2008 Mizuho International plc. and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the 
  * Free Software Foundation Europe e.V. Talstrasse 110, 40217 Dusseldorf, Germany 
  * or see the FSF site: http://www.fsfeurope.org/.
  * ====================================================================
  */
 package org.ikasan.common.configuration;
 
 
Java representation of the Ikasan XML configuration individual entry.

Author(s):
Ikasan Development Team
 
 public class Entry
 {
    
Logger
 
     private static Logger logger = Logger.getLogger(Entry.class);
    
key
 
     private String key;
    
value
 
     private String value;

    
Default constructor
 
     public Entry()
     {
         // Do Nothing
     }

    
Sets the entry key.

Parameters:
key
 
     public void setKey(final String key)
     {
         this. = key;
         .debug("Setting key [" + this. + "].");
     }

    
Gets the key.

Returns:
key
 
     public String getKey()
     {
         .debug("Getting key [" + this. + "].");
         return this.;
     }

    
Sets the entry value.

Parameters:
value
 
     public void setValue(final String value)
     {
         this. = value;
         .debug("Setting value [" + this. + "].");
     }

    
Gets the entry value.

Returns:
value
 
     public String getValue()
     {
         .debug("Getting value [" + this. + "].");
         return this.;
    }

    
Returns a string representation of this object.
    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        sb.append("Entry key [");
        sb.append(this.getKey());
        sb.append(']');
        sb.append(" value [");
        sb.append(this.getValue());
        sb.append("]; ");
        return sb.toString();
    }

    
Equality test

Parameters:
entry
Returns:
boolean
    public boolean equals(final Entry entry)
    {
        if ((this.getKey() == null && entry.getKey() == null)
                || this.getKey() != null
                && this.getKey().equals(entry.getKey())
                && (this.getValue() == null && entry.getValue() == null)
                || this.getValue() != null
                && this.getValue().equals(entry.getValue())) return true;
        return false;
    }

    
Converts the object to an XML string

Returns:
resulting XML string
    public String toXML()
    {
        XStream xstream = new XStream(new XppDriver(new XmlFriendlyReplacer(
            "$""_")));
        this.setXstreamProps(xstream);
        return xstream.toXML(this);
    }

    
Converts an incoming XML string to an object

Parameters:
xml XML string
Returns:
the Entry
    public Entry fromXML(String xml)
    {
        XStream xstream = new XStream(new DomDriver());
        this.setXstreamProps(xstream);
        return (Entryxstream.fromXML(xml);
    }

    
Sets the common properties for the toXML/fromXML XStream object

Parameters:
xstream
    protected void setXstreamProps(XStream xstream)
    {
        xstream.registerConverter(new EntryConverter());
        xstream.alias(this.getClass().getSimpleName(), this.getClass());
    }
New to GrepCode? Check out our FAQ X