/** * @throws RepositoryException * @see QValue#getBoolean() */ public boolean getBoolean() throws RepositoryException { if (type == PropertyType.BOOLEAN) { return (Boolean) val; } else { return Boolean.valueOf(getString()); } }
/** * @throws RepositoryException * @see QValue#getBoolean() */ public boolean getBoolean() throws RepositoryException { if (type == PropertyType.BOOLEAN) { return (Boolean) val; } else { return Boolean.valueOf(getString()); } }
/** * @see QValue#getLength() */ public long getLength() throws RepositoryException { return getString().length(); }
/** * @see QValue#getLength() */ public long getLength() throws RepositoryException { return getString().length(); }
/** * @see QValue#getDecimal() */ public BigDecimal getDecimal() throws RepositoryException { if (type == PropertyType.DECIMAL) { return (BigDecimal) val; } else if (type == PropertyType.DOUBLE) { return new BigDecimal((Double) val); } else if (type == PropertyType.LONG) { return new BigDecimal((Long) val); } else if (type == PropertyType.DATE) { return new BigDecimal(((Calendar) val).getTimeInMillis()); } else { try { return new BigDecimal(getString()); } catch (NumberFormatException e) { throw new ValueFormatException("not a valid decimal string: " + getString(), e); } } }
/** * @see QValue#getName() */ public Name getName() throws RepositoryException { if (type == PropertyType.NAME) { return (Name) val; } else { try { return AbstractQValueFactory.NAME_FACTORY.create(getString()); } catch (IllegalArgumentException e) { throw new ValueFormatException("not a valid Name value: " + getString(), e); } } }
/** * @see QValue#getPath() */ public Path getPath() throws RepositoryException { if (type == PropertyType.PATH) { return (Path) val; } else { try { return AbstractQValueFactory.PATH_FACTORY.create(getString()); } catch (IllegalArgumentException e) { throw new ValueFormatException("not a valid Path: " + getString(), e); } } }
/** * @see QValue#getName() */ public Name getName() throws RepositoryException { if (type == PropertyType.NAME) { return (Name) val; } else { try { return AbstractQValueFactory.NAME_FACTORY.create(getString()); } catch (IllegalArgumentException e) { throw new ValueFormatException("not a valid Name value: " + getString(), e); } } }
/** * @see QValue#getPath() */ public Path getPath() throws RepositoryException { if (type == PropertyType.PATH) { return (Path) val; } else { try { return AbstractQValueFactory.PATH_FACTORY.create(getString()); } catch (IllegalArgumentException e) { throw new ValueFormatException("not a valid Path: " + getString(), e); } } }
/** * @see QValue#getDecimal() */ public BigDecimal getDecimal() throws RepositoryException { if (type == PropertyType.DECIMAL) { return (BigDecimal) val; } else if (type == PropertyType.DOUBLE) { return new BigDecimal((Double) val); } else if (type == PropertyType.LONG) { return new BigDecimal((Long) val); } else if (type == PropertyType.DATE) { return new BigDecimal(((Calendar) val).getTimeInMillis()); } else { try { return new BigDecimal(getString()); } catch (NumberFormatException e) { throw new ValueFormatException("not a valid decimal string: " + getString(), e); } } }
/** * @see QValue#getDouble() */ public double getDouble() throws RepositoryException { if (type == PropertyType.DOUBLE) { return (Double) val; } else if (type == PropertyType.LONG) { return ((Long) val).doubleValue(); } else if (type == PropertyType.DATE) { return getCalendar().getTimeInMillis(); } else if (type == PropertyType.DECIMAL) { return ((BigDecimal) val).doubleValue(); } else { try { return Double.parseDouble(getString()); } catch (NumberFormatException ex) { throw new ValueFormatException("not a double: " + getString(), ex); } } }
/** * @see QValue#getDouble() */ public double getDouble() throws RepositoryException { if (type == PropertyType.DOUBLE) { return (Double) val; } else if (type == PropertyType.LONG) { return ((Long) val).doubleValue(); } else if (type == PropertyType.DATE) { return getCalendar().getTimeInMillis(); } else if (type == PropertyType.DECIMAL) { return ((BigDecimal) val).doubleValue(); } else { try { return Double.parseDouble(getString()); } catch (NumberFormatException ex) { throw new ValueFormatException("not a double: " + getString(), ex); } } }
/** * @see QValue#getLong() */ public long getLong() throws RepositoryException { if (type == PropertyType.LONG) { return (Long) val; } else if (type == PropertyType.DOUBLE) { return ((Double) val).longValue(); } else if (type == PropertyType.DECIMAL) { return ((BigDecimal) val).longValue(); } else if (type == PropertyType.DATE) { return getCalendar().getTimeInMillis(); } else { try { return Long.parseLong(getString()); } catch (NumberFormatException ex) { throw new ValueFormatException("not a long: " + getString(), ex); } } }
/** * @see QValue#getLong() */ public long getLong() throws RepositoryException { if (type == PropertyType.LONG) { return (Long) val; } else if (type == PropertyType.DOUBLE) { return ((Double) val).longValue(); } else if (type == PropertyType.DECIMAL) { return ((BigDecimal) val).longValue(); } else if (type == PropertyType.DATE) { return getCalendar().getTimeInMillis(); } else { try { return Long.parseLong(getString()); } catch (NumberFormatException ex) { throw new ValueFormatException("not a long: " + getString(), ex); } } }
/** * @see QValue#getCalendar() */ public Calendar getCalendar() throws RepositoryException { if (type == PropertyType.DOUBLE) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); cal.setTimeInMillis(((Double) val).longValue()); return cal; } else if (type == PropertyType.LONG) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); cal.setTimeInMillis((Long) val); return cal; } else if (type == PropertyType.DECIMAL) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); cal.setTimeInMillis(((BigDecimal) val).longValue()); return cal; } else { Calendar cal = ISO8601.parse(getString()); if (cal == null) { throw new ValueFormatException("not a date string: " + getString()); } else { return cal; } } }
/** * @see QValue#getCalendar() */ public Calendar getCalendar() throws RepositoryException { if (type == PropertyType.DOUBLE) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); cal.setTimeInMillis(((Double) val).longValue()); return cal; } else if (type == PropertyType.LONG) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); cal.setTimeInMillis((Long) val); return cal; } else if (type == PropertyType.DECIMAL) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); cal.setTimeInMillis(((BigDecimal) val).longValue()); return cal; } else { Calendar cal = ISO8601.parse(getString()); if (cal == null) { throw new ValueFormatException("not a date string: " + getString()); } else { return cal; } } }