Java Code Examples for javax.jcr.PropertyType#BOOLEAN
The following examples show how to use
javax.jcr.PropertyType#BOOLEAN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValueFactoryImpl.java From jackalope with Apache License 2.0 | 6 votes |
@Override public Value createValue(String value, int type) throws ValueFormatException { switch (type) { case PropertyType.STRING: return createValue(value); case PropertyType.LONG: return createValue(Long.valueOf(value)); case PropertyType.DOUBLE: return createValue(Double.valueOf(value)); case PropertyType.BOOLEAN: return createValue(Boolean.valueOf(value)); case PropertyType.DECIMAL: return createValue(new BigDecimal(value)); case PropertyType.DATE: // TODO: parse dates case PropertyType.BINARY: return createValue(createBinary(value)); default: return null; } }
Example 2
Source File: ValueImpl.java From jackalope with Apache License 2.0 | 5 votes |
private static int selectPropertyType(Object value) { return (value instanceof String) ? PropertyType.STRING : (value instanceof Long) ? PropertyType.LONG : (value instanceof Double) ? PropertyType.DOUBLE : (value instanceof BigDecimal) ? PropertyType.DECIMAL : (value instanceof Calendar) ? PropertyType.DATE : (value instanceof Boolean) ? PropertyType.BOOLEAN : (value instanceof Binary) ? PropertyType.BINARY : PropertyType.UNDEFINED; }
Example 3
Source File: CNDImporter.java From jackrabbit-filevault with Apache License 2.0 | 5 votes |
private int doPropertyType(Node pdi) throws ParseException, RepositoryException { if (!currentTokenEquals(Lexer.BEGIN_TYPE)) { return PropertyType.UNDEFINED; } nextToken(); int type = PropertyType.UNDEFINED; if (currentTokenEquals(Lexer.STRING)) { type = PropertyType.STRING; } else if (currentTokenEquals(Lexer.BINARY)) { type = PropertyType.BINARY; } else if (currentTokenEquals(Lexer.LONG)) { type = PropertyType.LONG; } else if (currentTokenEquals(Lexer.DOUBLE)) { type = PropertyType.DOUBLE; } else if (currentTokenEquals(Lexer.BOOLEAN)) { type = PropertyType.BOOLEAN; } else if (currentTokenEquals(Lexer.DATE)) { type = PropertyType.DATE; } else if (currentTokenEquals(Lexer.NAME)) { type = PropertyType.NAME; } else if (currentTokenEquals(Lexer.PATH)) { type = PropertyType.PATH; } else if (currentTokenEquals(Lexer.REFERENCE)) { type = PropertyType.REFERENCE; } else if (currentTokenEquals(Lexer.UNDEFINED)) { type = PropertyType.UNDEFINED; } else { lexer.fail("Unknown property type '" + currentToken + "' specified"); } pdi.setProperty(JcrConstants.JCR_REQUIREDTYPE, PropertyType.nameFromValue(type).toUpperCase()); nextToken(); if (!currentTokenEquals(Lexer.END_TYPE)) { lexer.fail("Missing '" + Lexer.END_TYPE + "' delimiter for end of property type"); } nextToken(); return type; }
Example 4
Source File: ValueImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public boolean getBoolean() throws ValueFormatException, RepositoryException { if (type != PropertyType.BOOLEAN) throw new ValueFormatException(); return (boolean)valueObject; }
Example 5
Source File: ValueFactoryImpl.java From jackalope with Apache License 2.0 | 4 votes |
@Override public Value createValue(boolean value) { return new ValueImpl(PropertyType.BOOLEAN, value); }