com.sap.netweaver.bc.uwl

Class Attribute

java.lang.Object
  extended by com.sap.netweaver.bc.uwl.Attribute
All Implemented Interfaces:
Serializable

public final class Attribute
extends Object
implements Serializable

The Attribute represents grouping around items attribute type and value. Some of the attributes of Item may be unique to the instance of Item in question. Such attributes will be described with the help of this class. These generic Attributes are accessible through item.getAttributes() method. Various types of attributes including arrays are supported.

See Also:
Serialized Form

Field Summary
static char TYPE_BOOL
          The character b stands for a boolean attribute.
static char TYPE_DATE
          The character t stands for a date attribute.
static char TYPE_DOUBLE
          The character d stands for a double precision floating-point number attribute.
static char TYPE_INT
          The character i stands for an integer attribute.
static char TYPE_LONG
          The character l stands for a Long attribute.
static char TYPE_STRING
          The character s stands for a string attribute.
static char TYPE_USER
          The character u stands for a user attribute.
 
Method Summary
static Attribute createAttribute(String name, boolean value)
          This static method creates a boolean attribute.
static Attribute createAttribute(String name, Boolean value)
          This static method creates a boolean attribute.
static Attribute createAttribute(String name, boolean[] values)
          This static method creates a boolean attribute.
static Attribute createAttribute(String name, Boolean[] values)
          This static method creates a boolean attribute.
static Attribute createAttribute(String name, char type)
          This static method creates an attribute of the given type.
static Attribute createAttribute(String name, Date value)
          This static method creates a date attribute.
static Attribute createAttribute(String name, Date[] values)
          This static method creates a date attribute.
static Attribute createAttribute(String name, double value)
          This static method creates a double precision floating-point number attribute.
static Attribute createAttribute(String name, Double value)
          This static method creates a double precision floating-point number attribute.
static Attribute createAttribute(String name, double[] values)
          This static method creates a double attributes.
static Attribute createAttribute(String name, Double[] values)
          This static method creates a double precision floating-point number attribute.
static Attribute createAttribute(String name, int value)
          This static method creates an integer attribute.
static Attribute createAttribute(String name, int[] values)
          This static method creates an integer attribute.
static Attribute createAttribute(String name, Integer value)
          This static method creates an integer attribute.
static Attribute createAttribute(String name, Integer[] values)
          This static method creates an integer attribute.
static Attribute createAttribute(String name, com.sap.security.api.IUser value)
          This static method creates a User attribute.
static Attribute createAttribute(String name, com.sap.security.api.IUser[] values)
          This static method creates a User attribute.
static Attribute createAttribute(String name, long value)
          This static method creates a Long attribute.
static Attribute createAttribute(String name, Long value)
          This static method creates a long attribute.
static Attribute createAttribute(String name, long[] values)
          This static method creates a long attribute.
static Attribute createAttribute(String name, Long[] values)
          This static method creates a long attribute.
static Attribute createAttribute(String name, Object value)
          This method takes an instance of Object as the value.
static Attribute createAttribute(String name, Object[] values)
          This method takes an instance of Object as the value.
static Attribute createAttribute(String name, String value)
          This static method creates a string attribute.
static Attribute createAttribute(String name, String[] values)
          This static method creates a string attribute.
static Attribute createAttribute(String name, String[] values, boolean isUserID)
          This static method creates a string or a user attribute.
static Attribute createAttribute(String name, String value, boolean isUserID)
          This static method creates a string or a user attribute.
 boolean equals(Object obj)
           
 String getName()
           
 String getStringValue()
          This is similar to getValue() except for the fact it returns the string value instead of the object itself.
 char getType()
           
 Object getValue()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_STRING

public static final char TYPE_STRING
The character s stands for a string attribute. This is one of the attribute types stored in the database. these types should not exceed two bytes.

See Also:
Constant Field Values

TYPE_INT

public static final char TYPE_INT
The character i stands for an integer attribute. This is one of the attribute types stored in the database.

See Also:
Constant Field Values

TYPE_LONG

public static final char TYPE_LONG
The character l stands for a Long attribute. This is one of the attribute types stored in the database.

See Also:
Constant Field Values

TYPE_DATE

public static final char TYPE_DATE
The character t stands for a date attribute. This is one of the attribute types stored in the database.

See Also:
Constant Field Values

TYPE_DOUBLE

public static final char TYPE_DOUBLE
The character d stands for a double precision floating-point number attribute. This is one of the attribute types stored in the database.

See Also:
Constant Field Values

TYPE_BOOL

public static final char TYPE_BOOL
The character b stands for a boolean attribute. This is one of the attribute types stored in the database. these types should not exceed two bytes.

See Also:
Constant Field Values

TYPE_USER

public static final char TYPE_USER
The character u stands for a user attribute. This is one of the attribute types stored in the database. these types should not exceed two bytes.

See Also:
Constant Field Values
Method Detail

getName

public String getName()
Returns:
String name of the attribute. It could be null even though it is very unlikely.

getValue

public Object getValue()
Returns:
Object the value of the attribute in question. Could be null. In fact, it is Serializable. If it is not null, it can be an array.

getStringValue

public String getStringValue()
This is similar to getValue() except for the fact it returns the string value instead of the object itself.

Returns:
String the value of the attribute as a string. If the value is null, it returns an empty string but not null. If value is an array, it returns a comma separated string. It does not insert anything for null values in the array.

toString

public String toString()
Overrides:
toString in class Object
Returns:
String the string representation of value of the attribute by calling getStringValue().
See Also:
Object.toString(), getValue()

getType

public char getType()
Returns:
char the type of the attribute. It can be Integer, Double, String, etc.

createAttribute

public static Attribute createAttribute(String name,
                                        int value)
This static method creates an integer attribute.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Be careful when it equals 0 since there exists no way of passing a null value. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_INT.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        long value)
This static method creates a Long attribute.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Be careful when it equals 0 since there exists no way of passing a null value. If the value equals null, it is better to use createAttribute(java.lang.String, char).
Returns:
Attribute a new attribute with type equal to TYPE_LONG.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        int[] values)
This static method creates an integer attribute. This instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. This is an array of integers (ints). The length of the array can be zero. Be careful when any element of this array equals 0 since there exists no way of passing a null value.
Returns:
Attribute a new attribute with type equal to TYPE_INT.

createAttribute

public static Attribute createAttribute(String name,
                                        long[] values)
This static method creates a long attribute. This instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. This is an array of longs. The length of the array can be zero. Be careful when any element of this array equals 0 since there exists no way of passing a null value.
Returns:
Attribute a new attribute with type equal to TYPE_LONG.

createAttribute

public static Attribute createAttribute(String name,
                                        Integer value)
This static method creates an integer attribute. The only difference from createAttribute(java.lang.String, int) is that it takes the wrapper object of int Integer.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_INT.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Long value)
This static method creates a long attribute. The only difference from createAttribute(java.lang.String, long) is that it takes the wrapper object of long Long.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_LONG.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Integer[] values)
This static method creates an integer attribute. The difference from createAttribute(java.lang.String, int) is that it takes the wrapper object of int Integer. In addition to that, the value of this attribute represents an array of integers.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). Even if it does not equal null, the length of the array can equal zero.
Returns:
Attribute a new attribute with type equal to TYPE_INT.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Long[] values)
This static method creates a long attribute. The difference from createAttribute(java.lang.String, long) is that it takes the wrapper object of long Long. In addition to that, the value of this attribute represents an array of longs.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). Even if it does not equal null, the length of the array can equal zero.
Returns:
Attribute a new attribute with type equal to TYPE_INT.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        String value)
This static method creates a string attribute.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_STRING.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        String[] values)
This static method creates a string attribute. The value of this instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). The length of the array can be zero.
Returns:
Attribute a new attribute with type equal to TYPE_STRING.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Date value)
This static method creates a date attribute.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_DATE.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Date[] values)
This static method creates a date attribute. This instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). The length of the array can be zero.
Returns:
Attribute a new attribute with type equal to TYPE_DATE.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        double value)
This static method creates a double precision floating-point number attribute.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Be careful when it equals 0 since there exists no way of passing a null value. If the value equals null, it is better to use createAttribute(java.lang.String, char).
Returns:
Attribute a new attribute with type equal to TYPE_DOUBLE.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        double[] values)
This static method creates a double attributes. This instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. This is an array of doubles The length of the array can be zero. Be careful when any element of this array equals 0 since there exists no way of passing a null value.
Returns:
Attribute a new attribute with type equal to TYPE_DOUBLE.

createAttribute

public static Attribute createAttribute(String name,
                                        Double value)
This static method creates a double precision floating-point number attribute. This is similar to createAttribute(java.lang.String, double) except for the fact that it expects an instance of the wrapper object of double.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_DOUBLE.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Double[] values)
This static method creates a double precision floating-point number attribute. This is similar to createAttribute(java.lang.String, double) except for the fact that it expects an instance of the wrapper object of double. In addition to that, this instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). Even if it does not equal null, the length of the array can equal zero.
Returns:
Attribute a new attribute with type equal to TYPE_DOUBLE.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        boolean value)
This static method creates a boolean attribute.

Parameters:
value - the value of the attribute. Be careful when it equals false since there exists no way of passing a null value. If the value equals null, it is better to use createAttribute(java.lang.String, char).
Returns:
Attribute a new attribute with type equal to TYPE_BOOL.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        boolean[] values)
This static method creates a boolean attribute. This instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. This is an array of booleans The length of the array can be zero. Be careful when any element of this array equals false since there exists no way of passing a null value.
Returns:
Attribute a new attribute with type equal to TYPE_BOOL.

createAttribute

public static Attribute createAttribute(String name,
                                        Boolean value)
This static method creates a boolean attribute. This is similar to createAttribute(java.lang.String, boolean) except for the fact that it expects an instance of the wrapper object of boolean.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_BOOL.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Boolean[] values)
This static method creates a boolean attribute. This is similar to createAttribute(java.lang.String, boolean) except for the fact that it expects an instance of the wrapper object of boolean. In addition to that, this instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). Even if it does not equal null, the length of the array can equal zero.
Returns:
Attribute a new attribute with type equal to TYPE_BOOL.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        Object value)
This method takes an instance of Object as the value. It tries to see whether this value is an instance of Integer, Double, Boolean, String, etc. If it cannot figure it out, it will take the string representation of this value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute the type depends on the type of the value. It can be null if the value is null.

createAttribute

public static Attribute createAttribute(String name,
                                        Object[] values)
This method takes an instance of Object as the value. This attribute can have more than one value. It tries to see whether this value is an instance of Integer, Double, Boolean, String, etc. If it cannot figure it out, it will take the string representation of this value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). Even if it does not equal null, the length of the array can equal zero.
Returns:
Attribute the type depends on the type of the value. It can be null if the value is null.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        com.sap.security.api.IUser value)
This static method creates a User attribute.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
Returns:
Attribute a new attribute with type equal to TYPE_USER.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        com.sap.security.api.IUser[] values)
This static method creates a User attribute. This instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). Even if it does not equal null, the length of the array can equal zero.
Returns:
Attribute a new attribute with type equal to TYPE_USER.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        String value,
                                        boolean isUserID)
This static method creates a string or a user attribute.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
value - the value of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char).
isUserID - If it is false, a string attribute will be created.
Returns:
Attribute a new attribute with type equal to TYPE_USER if isUserID is true. Otherwise, the type will be TYPE_STRING.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        String[] values,
                                        boolean isUserID)
This static method creates a string or a user attribute. The value of this instance can possibly have more than one value.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
values - the values of the attribute. Could be null. If the value equals null, it is better to use createAttribute(String, char). Even if it does not equal null, the length of the array can equal zero.
isUserID - If it is false, a string attribute will be created.
Returns:
Attribute a new attribute with type equal to TYPE_USER if isUserID is true. Otherwise, the type will be TYPE_STRING.
See Also:
createAttribute(java.lang.String, char)

createAttribute

public static Attribute createAttribute(String name,
                                        char type)
This static method creates an attribute of the given type. This is used when the value is null.

Parameters:
name - the name of the attribute. Accepts null even though it it is not advisable to pass a null value.
type - any one of the types like integer, double, boolean, ETC.
Returns:
Attribute an attribute with value equal to null.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] UWLJWF [sap.com] tc/kmc/bc.uwl/api default EP-BC-UWL
[sap.com] UWLJWF [sap.com] tc/kmc/bc.uwl/api - EP-BC-UWL


Copyright 2012 SAP AG Complete Copyright Notice