1. /*
  2. * @(#)BooleanValueExp.java 4.17 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.management;
  8. /**
  9. * This class represents a boolean value. A BooleanValueExp may be
  10. * used anywhere a ValueExp is required.
  11. * @serial include
  12. *
  13. * @since 1.5
  14. */
  15. class BooleanValueExp extends QueryEval implements ValueExp {
  16. /* Serial version */
  17. private static final long serialVersionUID = 7754922052666594581L;
  18. /**
  19. * @serial The boolean value
  20. */
  21. private boolean val = false;
  22. /** Creates a new BooleanValueExp representing the boolean literal <val>.*/
  23. BooleanValueExp(boolean val) {
  24. this.val = val;
  25. }
  26. /**Creates a new BooleanValueExp representing the Boolean object <val>.*/
  27. BooleanValueExp(Boolean val) {
  28. this.val = val.booleanValue();
  29. }
  30. /** Returns the Boolean object representing the value of the BooleanValueExp object.*/
  31. public Boolean getValue() {
  32. return new Boolean(val);
  33. }
  34. /**
  35. * Returns the string representing the object.
  36. */
  37. public String toString() {
  38. return String.valueOf(val);
  39. }
  40. /**
  41. * Applies the ValueExp on a MBean.
  42. *
  43. * @param name The name of the MBean on which the ValueExp will be applied.
  44. *
  45. * @return The <CODE>ValueExp</CODE>.
  46. *
  47. * @exception BadStringOperationException
  48. * @exception BadBinaryOpValueExpException
  49. * @exception BadAttributeValueExpException
  50. * @exception InvalidApplicationException
  51. */
  52. public ValueExp apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException,
  53. BadAttributeValueExpException, InvalidApplicationException {
  54. return this;
  55. }
  56. }