PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Java|javax|management|AttributeValueExp.java =

page 1 of 2



/*
 * @(#)AttributeValueExp.java	4.25 05/11/17
 * 
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package javax.management;


// RI import
import javax.management.MBeanServer;

/**
 * Represents attributes used as arguments to relational constraints. 
 * An <CODE>AttributeValueExp</CODE> may be used anywhere a <CODE>ValueExp</CODE> is required.
 *
 * @since 1.5
 */
public class AttributeValueExp implements ValueExp  { 


    /* Serial version */
    private static final long serialVersionUID = -7768025046539163385L;

    /** 
     * @serial The name of the attribute 
     */
    private String attr;

    /**
     * An <code>AttributeValueExp</code> with a null attribute.
     * @deprecated An instance created with this constructor cannot be
     * used in a query.
     */
    @Deprecated
    public AttributeValueExp() { 
    } 
       
    /**
     * Creates a new <CODE>AttributeValueExp</CODE> representing the
     * specified object attribute, named attr.
     *
     * @param attr the name of the attribute whose value is the value
     * of this {@link ValueExp}.
     */
    public AttributeValueExp(String attr) { 
	this.attr = attr;
    } 
    
    /**
     * Returns a string representation of the name of the attribute.
     *
     * @return the attribute name.
     */
    public String getAttributeName()  { 
	return attr;
    } 

    /**
     * Applies the <CODE>AttributeValueExp</CODE> on an MBean.
     *
     * @param name The name of the MBean on which the <CODE>AttributeValueExp</CODE> will be applied.
     *
     * @return  The <CODE>ValueExp</CODE>.
     *
     * @exception BadAttributeValueExpException
     * @exception InvalidApplicationException
     * @exception BadStringOperationException
     * @exception BadBinaryOpValueExpException
     *
     */
    public ValueExp apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException,
	BadAttributeValueExpException, InvalidApplicationException {
	Object result = getAttribute(name);
	
	if (result instanceof Number) {
	    return new NumericValueExp((Number)result);
	} else if (result instanceof String) {
	    return new StringValueExp((String)result);
	} else if (result instanceof Boolean) {
	    return new BooleanValueExp((Boolean)result);
	} else {
	    throw new BadAttributeValueExpException(result);
	}
    } 

    /**
     * Returns the string representing its value.
     */
    public String toString()  { 
	return attr;
    } 
    

    /**
     * Sets the MBean server on which the query is to be performed.
     *
     * @param s The MBean server on which the query is to be performed.
     */
=1=

= PAGE 1 = NEXT > |2

UP TO ROOT | UP TO DIR

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.0272441 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)