/** * convert this Year to a string * The format is defined by W3C XML Schema draft and ISO8601 * i.e (+|-)CCYY * @return a string representing this Month */ public String toString() { StringBuffer result = new StringBuffer(); result.append(this.getCentury()); if (result.length() == 1) result.insert(0,0); if ((this.getYear()/10) == 0) result.append(0); result.append(this.getYear()); 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 * (+|-)CCYY * * @return a string representing this Month */ public String toString() { StringBuilder result = new StringBuilder(); result.append(this.getCentury()); if (result.length() == 1) result.insert(0, 0); if ((this.getYear() / 10) == 0) result.append(0); result.append(this.getYear()); 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 Year)) { // -- throw exception } Year yearTarget = (Year) target; if (value == null) { /// do something } // -- update current instance of time with new year try { Year temp = Year.parseYear(value.toString()); yearTarget.setCentury(temp.getCentury()); yearTarget.setYear(temp.getYear()); } catch (Exception 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 Year) ) { //-- throw exception } Year yearTarget = (Year) target; if (value == null) { /// do something } //-- update current instance of time with new year try { Year temp = Year.parseYear(value.toString()) ; yearTarget.setCentury(temp.getCentury()); yearTarget.setYear(temp.getYear()); } catch (Exception ex) { //-- ignore for now } } //-- setValue