1. /*
  2. * @(#)StringValueExp.java 4.19 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. * Represents strings that are arguments to relational constraints.
  10. * A <CODE>StringValueExp</CODE> may be used anywhere a <CODE>ValueExp</CODE> is required.
  11. *
  12. * @since 1.5
  13. */
  14. public class StringValueExp implements ValueExp {
  15. /* Serial version */
  16. private static final long serialVersionUID = -3256390509806284044L;
  17. /**
  18. * @serial The string literal
  19. */
  20. private String val;
  21. /**
  22. * Basic constructor.
  23. */
  24. public StringValueExp() {
  25. }
  26. /**
  27. * Creates a new <CODE>StringValueExp</CODE> representing the
  28. * given string.
  29. *
  30. * @param val the string that will be the value of this expression
  31. */
  32. public StringValueExp(String val) {
  33. this.val = val;
  34. }
  35. /**
  36. * Returns the string represented by the
  37. * <CODE>StringValueExp</CODE> instance.
  38. *
  39. * @return the string.
  40. */
  41. public String getValue() {
  42. return val;
  43. }
  44. /**
  45. * Returns the string representing the object.
  46. */
  47. public String toString() {
  48. return "'" + val + "'";
  49. }
  50. /**
  51. * Sets the MBean server on which the query is to be performed.
  52. *
  53. * @param s The MBean server on which the query is to be performed.
  54. */
  55. public void setMBeanServer(MBeanServer s) { }
  56. /**
  57. * Applies the ValueExp on a MBean.
  58. *
  59. * @param name The name of the MBean on which the ValueExp will be applied.
  60. *
  61. * @return The <CODE>ValueExp</CODE>.
  62. *
  63. * @exception BadStringOperationException
  64. * @exception BadBinaryOpValueExpException
  65. * @exception BadAttributeValueExpException
  66. * @exception InvalidApplicationException
  67. */
  68. public ValueExp apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException,
  69. BadAttributeValueExpException, InvalidApplicationException {
  70. return this;
  71. }
  72. }