/** * Method to create the variable from the attribute value and the given SMI syntax value * @param value attribute value * @param smiSyntax attribute SMI Syntax * @return variable */ private Variable stringToVariable(String value, int smiSyntax) { Variable var = AbstractVariable.createFromSyntax(smiSyntax); try { if (var instanceof AssignableFromString) { ((AssignableFromString) var).setValue(value); } else if (var instanceof AssignableFromInteger) { ((AssignableFromInteger) var).setValue(Integer.valueOf(value)); } else if (var instanceof AssignableFromLong) { ((AssignableFromLong) var).setValue(Long.valueOf(value)); } else { this.getLogger().error("Unsupported conversion of [" + value +"] to " + var.getSyntaxString()); var = null; } } catch (IllegalArgumentException e) { this.getLogger().error("Unsupported conversion of [" + value +"] to " + var.getSyntaxString(), e); var = null; } return var; }
public synchronized void setValue(String value) { if (variable instanceof AssignableFromString) { ((AssignableFromString)variable).setValue(value); } else { throw new ClassCastException("A string value cannot be assigned to "+ variable); } }
public synchronized void setValue(String value) { if (variable instanceof AssignableFromString) { ((AssignableFromString)variable).setValue(value); } else { throw new ClassCastException("A string value cannot be assigned to "+ variable); } }
public synchronized void setValue(String value) { if (variable instanceof AssignableFromString) { ((AssignableFromString)variable).setValue(value); } else { throw new ClassCastException("A string value cannot be assigned to "+ variable); } }
/** * This operation is not supported by {@link SimpleVariableTextFormat}. * * @param smiSyntax the SMI syntax identifier identifying the target * <code>Variable</code>. * @param text a textual representation of the variable. * @return the new <code>Variable</code> instance. * @throws ParseException if the variable cannot be parsed successfully. */ public Variable parse(int smiSyntax, String text) throws ParseException { Variable v = AbstractVariable.createFromSyntax(smiSyntax); if (v instanceof AssignableFromString) { ((AssignableFromString)v).setValue(text); } return v; }
/** * This operation is not supported by {@link SimpleVariableTextFormat}. * * @param smiSyntax the SMI syntax identifier identifying the target * <code>Variable</code>. * @param text a textual representation of the variable. * @return the new <code>Variable</code> instance. * @throws ParseException if the variable cannot be parsed successfully. */ public Variable parse(int smiSyntax, String text) throws ParseException { Variable v = AbstractVariable.createFromSyntax(smiSyntax); if (v instanceof AssignableFromString) { ((AssignableFromString)v).setValue(text); } return v; }
/** * This operation is not supported by {@link SimpleVariableTextFormat}. * * @param smiSyntax the SMI syntax identifier identifying the target * <code>Variable</code>. * @param text a textual representation of the variable. * @return the new <code>Variable</code> instance. * @throws ParseException if the variable cannot be parsed successfully. */ public Variable parse(int smiSyntax, String text) throws ParseException { Variable v = AbstractVariable.createFromSyntax(smiSyntax); if (v instanceof AssignableFromString) { ((AssignableFromString)v).setValue(text); } return v; }
/** * This operation is not supported by {@link ColonSeparatedOidTypeValueVariableTextFormat}. * * @param smiSyntax the SMI syntax identifier identifying the target * <code>Variable</code>. * @param text a textual representation of the variable. * @return the new <code>Variable</code> instance. * @throws ParseException if the variable cannot be parsed successfully. */ public Variable parse(int syntax, String value) { Variable v = AbstractVariable.createFromSyntax(syntax); if (v instanceof AssignableFromString) { ((AssignableFromString)v).setValue(value); } else { throw new AssertionError("Never get here."); } return v; }
/** * This operation is not supported by {@link NetSnmpVariableTextFormat}. * * @param smiSyntax the SMI syntax identifier identifying the target * <code>Variable</code>. * @param text a textual representation of the variable. * @return the new <code>Variable</code> instance. * @throws ParseException if the variable cannot be parsed successfully. */ public Variable parse(int syntax, String value) { Variable v = AbstractVariable.createFromSyntax(syntax); if (v instanceof AssignableFromString) { ((AssignableFromString)v).setValue(value); } else if (syntax == SMIConstants.SYNTAX_NULL) { // Do nothing } else { throw new AssertionError("Never get here."); } return v; }
/** * @param value. * @param smiSyntax. * @return false or true on the basis of method. method to set the string * value to mib oid. */ public static Variable stringToVariable(String value, int smiSyntax) { Variable var = AbstractVariable.createFromSyntax(smiSyntax); if (var instanceof AssignableFromString) { ((AssignableFromString) var).setValue(value); } else { throw new IllegalArgumentException("Unsupported conversion from String to " + var.getSyntaxString()); } return var; }
/** * Method to create the variable from the attribute value and the given SMI syntax value * @param value attribute value * @param smiSyntax attribute SMI Syntax * @return variable */ private Variable stringToVariable(String value, int smiSyntax) { Variable var = AbstractVariable.createFromSyntax(smiSyntax); try { if (var instanceof AssignableFromString) { ((AssignableFromString) var).setValue(value); } else if (var instanceof AssignableFromInteger) { ((AssignableFromInteger) var).setValue(Integer.valueOf(value)); } else if (var instanceof AssignableFromLong) { ((AssignableFromLong) var).setValue(Long.valueOf(value)); } else { this.getLogger().error("Unsupported conversion of [" + value +"] to " + var.getSyntaxString()); var = null; } } catch (IllegalArgumentException e) { this.getLogger().error("Unsupported conversion of [" + value +"] to " + var.getSyntaxString(), e); var = null; } return var; }