Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 1996-2001
   * Logica Mobile Networks Limited
   * All rights reserved.
   *
   * This software is distributed under Logica Open Source License Version 1.0
   * ("Licence Agreement"). You shall use it and distribute only in accordance
   * with the terms of the License Agreement.
   *
  */
 package org.smpp.smscsim.util;

Represents an attribute (field) of a Record. Each attribute has name and a value. Values are textual, i.e. if you want to use this class to work with integral values, you have to cast the values explicitly.

Author(s):
Logica Mobile Networks SMPP Open Source Team
Version:
$Revision: 1.1 $
See also:
Record
Table
 
 public class Attribute {
The name of the attribute
 
 	private String name = null;

The value of the attribute.
 
 	private String value = null;

Default constructor initialises name and value of the attribute to empty (null) values.

 
 	public Attribute() {
 	}

If you know the name but not the value yet, use this constructor.

 
 	public Attribute(String name) {
 		this. = name;
 	}

Initialises the attribute's both name and value
 
 	public Attribute(String nameString value) {
 		this. = name;
 		this. = value;
 	}

Sets the name of the attribute.

Parameters:
name the new value for the name of the attribute.
 
 	public void setName(String name) {
 		this. = name;
 	}

Sets the value of the attribute.

Parameters:
value the new vlaue of the attribute.
 
 	public void setValue(String value) {
 		this. = value;
 	}

Returns the name of the attribute.

Returns:
the name of the attribute
 
 	public String getName() {
 		return ;
 	}

Returns the current value of the attribute.

Returns:
the current value of the attribute
 
 	public String getValue() {
 		return ;
 	}

Compares the name of the attribute to the provided value. The comparison is case sensitive, i.e. 'Password' and 'password' are different names!

Parameters:
name the name to compare the attribute's name to
Returns:
if the name of the attribute is equal to the provided name
 
 	public boolean nameEquals(String name) {
		if (this. != null) {
			return this..equals(name);
else {
			return name == null// nulls are equal
		}
	}

Compares two attributes if their names and values are equal.

Parameters:
attr the attribute to compare this attribute to
Returns:
if the attribute's name & value are equal to those of the provided
	public boolean equals(Attribute attr) {
		if (attr != null) {
			if (nameEquals(attr.getName())) {
				if (this. != null) {
					return this..equals();
else {
					return  == null// nulls are equal
				}
else {
				return false;
			}
else {
			return false;
		}
	}
/*
 * $Log: not supported by cvs2svn $
 */
New to GrepCode? Check out our FAQ X