/** * convert this Year to a string * The format is defined by W3C XML Schema draft and ISO8601 * i.e (+|-)CC * @return a string representing this Century */ public String toString() { StringBuffer result = new StringBuffer(); result.append(String.valueOf(this.getCentury())); if (result.length() == 1) { result.insert(0,0); } if (isNegative()) { result.insert(0,"-"); } return result.toString(); }//toString
/** * convert this Year to a string The format is defined by W3C XML Schema draft and ISO8601 i.e * (+|-)CC * * @return a string representing this Century */ public String toString() { StringBuilder result = new StringBuilder(String.valueOf(this.getCentury())); if (result.length() == 1) { result.insert(0, 0); } if (isNegative()) { result.insert(0, '-'); } return result.toString(); }// toString
/** * Sets the value of the field associated with this descriptor. * @param target the object in which to set the value * @param value the value of the field */ public void setValue(Object target, Object value) throws java.lang.IllegalStateException { if (! (target instanceof Century) ) { //-- throw exception } Century centuryTarget = (Century) target; if (value == null) { /// do something } //-- update current instance of century with new century try { Century temp = Century.parseCentury(value.toString()) ; centuryTarget.setCentury(temp.getCentury()); } catch (java.text.ParseException ex) { //ignore for now } } //-- setValue
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field */ public void setValue(Object target, Object value) throws java.lang.IllegalStateException { if (!(target instanceof Century)) { // -- throw exception } Century centuryTarget = (Century) target; if (value == null) { /// do something } // -- update current instance of century with new century try { Century temp = Century.parseCentury(value.toString()); centuryTarget.setCentury(temp.getCentury()); } catch (java.text.ParseException ex) { // ignore for now } } // -- setValue