FileDocCategorySizeDatePackage
InQueryExp.javaAPI DocJava SE 5 API2877Fri Aug 26 14:57:32 BST 2005javax.management

InQueryExp

public class InQueryExp extends QueryEval implements QueryExp
This class is used by the query-building mechanism to represent binary operations.
serial
include
since
1.5

Fields Summary
private static final long
serialVersionUID
private ValueExp
val
private ValueExp[]
valueList
Constructors Summary
public InQueryExp()
Basic Constructor.



           
       
    
public InQueryExp(ValueExp v1, ValueExp[] items)
Creates a new InQueryExp with the specified ValueExp to be found in a specified array of ValueExp.

 
	val	  = v1;
	valueList = items;
    
Methods Summary
public booleanapply(javax.management.ObjectName name)
Applies the InQueryExp on a MBean.

param
name The name of the MBean on which the InQueryExp will be applied.
return
True if the query was successfully applied to the MBean, false otherwise.
exception
BadStringOperationException
exception
BadBinaryOpValueExpException
exception
BadAttributeValueExpException
exception
InvalidApplicationException

 
	if (valueList != null) {
	    ValueExp v	    = val.apply(name);
	    boolean numeric = v instanceof NumericValueExp;
	    
	    for (int i = 0; i < valueList.length; i++) {
		if (numeric) {
		    if (((NumericValueExp)valueList[i]).doubleValue() ==
			((NumericValueExp)v).doubleValue()) {
			return true;
		    }
		} else {
		    if (((StringValueExp)valueList[i]).getValue().equals(
			((StringValueExp)v).getValue())) {
			return true;
		    }
		}
	    }
	}	
	return false;
    
private java.lang.StringgenerateValueList()

	if (valueList == null || valueList.length == 0) {
	    return "";
	}
	
	StringBuffer result = new StringBuffer(valueList[0].toString());
	
	for (int i = 1; i < valueList.length; i++) {
	    result.append(", ");
	    result.append(valueList[i]);
	}
	
	return result.toString();
    
public javax.management.ValueExpgetCheckedValue()
Returns the checked value of the query.

 
	return val;
    
public javax.management.ValueExp[]getExplicitValues()
Returns the array of values of the query.

 
	return valueList;
    
public java.lang.StringtoString()
Returns the string representing the object.

 
	return val + " in (" + generateValueList() + ")";