Read an expected boolean.

@param o  the object to parse
@param id the id in the map that should point to the boolean
@return the boolean
@throws org.btrplace.json.JSONConverterException if the key does not point to a boolean
325969
public static boolean requiredBoolean(JSONObject o, String id) throws JSONConverterException {
        checkKeys(o, id);
        Object x = o.get(id);
        if (!(x instanceof Boolean)) {
            throw new JSONConverterException("Boolean expected at key '" + id + "' but was '" + x.getClass() + "'.");
        }
        return (Boolean) x;
    }
1263219
public final void boolean_key() throws RecognitionException {
		Token id=null;

		try {
			// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:760:5: ({...}? =>id= ID )
			// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:760:12: {...}? =>id= ID
			{
			if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))) ) {
				if (state.backtracking>0) {state.failed=true; return;}
				throw new FailedPredicateException(input, "boolean_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN))");
			}
			id=(Token)match(input,ID,FOLLOW_ID_in_boolean_key4824); if (state.failed) return;
			if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); }
			}

		}

		catch (RecognitionException re) {
		    throw re;
		}

		finally {
			// do for sure before leaving
		}
	}
387626
public E getById(String id) {
        if (id == null) {
            for (E element : this) {
                if (element != null && element.getId() == null) {
                    return element;
                }
            }
        } else {
            for (E element : this) {
                if (element != null && id.equals(element.getId())) {
                    return element;
                }
            }
        }
        return null;
    }
76043
public boolean getBoolean(String key, boolean def) {
        try {
            if (!contains(key)) {
                return def;
            }
            return (Boolean) get(key);
        } catch (Exception e) {
            return def;
        }
    }
433534
static boolean readBoolean(Node node)
    {
        if (node == null)
        {
            throw new XmlException(
                "Tried to read boolean value from null node");
        }
        String value = node.getFirstChild().getNodeValue();
        return Boolean.parseBoolean(value);
    }
929218
public static Node requiredNode(Model mo, JSONObject o, String id) throws JSONConverterException {
        checkKeys(o, id);
        try {
            return getNode(mo, (Integer) o.get(id));
        } catch (ClassCastException e) {
            throw new JSONConverterException("Unable to read a Node identifier from string at key '" + id + "'", e);
        }
    }
454406
private Boolean readOptionalBoolean(JSONValue val) {

        JSONBoolean b = null == val ? null : val.isBoolean();
        if (b != null) {
            return Boolean.valueOf(b.booleanValue());
        }
        return null;
    }
925896
private CmsUUID readOptionalUUID(JSONObject json, String key) {

        String id = readOptionalString(json, key, null);
        if (null != id) {
            try {
                CmsUUID uuid = CmsUUID.valueOf(id);
                return uuid;
            } catch (NumberFormatException e) {
                LOG.debug("Reading optional UUID failed. Could not convert \"" + id + "\" to a valid UUID.");
            }
        }
        return null;
    }
1027314
public Boolean getBoolean(int index, boolean strict) throws JsonException {
        JsonElement el = get(index);
        Boolean res = null;
        if (strict && !el.isBoolean()) {
            throw Util.typeMismatch(index, el, "boolean", true);
        }
        if (el.isBoolean()) {
            res = el.asBoolean();
        }
        if (el.isString()) {
            res = Util.toBoolean(el.asString());
        }
        if (res == null)
            throw Util.typeMismatch(index, el, "boolean", strict);
        return res;
    }
1153488
public static JsonBooleanDocument create(String id, Boolean content) {
        return new JsonBooleanDocument(id, 0, content, 0, null);
    }
784261
public boolean getBoolean( int index ) throws OdaException
    {
    	Boolean value = (Boolean) getFieldValue(index);
        return value==null?false:value;
    }
830417
public Boolean getAsBoolean(String key) {
        Object value = mValues.get(key);
        try {
            return (Boolean) value;
        } catch (ClassCastException e) {
            if (value instanceof CharSequence) {
                return Boolean.valueOf(value.toString());
            } else if (value instanceof Number) {
                return ((Number) value).intValue() != 0;
            } else {
                logger.log(Level.SEVERE, "Cannot cast value for " + key + " to a Boolean: " + value, e);
                return false;
            }
        }
    }
1243648
protected T _jdoLoad(
                    final K id
                    )
    {
        if (id == null) {
            return null;
        }

        Object  p_object = null;
        try {
            p_object = getCastorTemplate().load( _objectType, id );
        } catch (DataAccessException ex) {
            Throwable  cause = ex.getMostSpecificCause();
            if (ObjectNotFoundException.class.isInstance( cause )) {
                p_object = null;
            } else {
                throw new PersistenceException( cause );
            }
        }


        T  typedObject = _objectType.cast( p_object );
//        _afterLoad( typedObject );

        return typedObject;
    }
1248975
public <P extends ParaObject> P read(String id) {
		if (StringUtils.isBlank(id)) {
			return null;
		}
		Map<String, Object> data = getEntity(invokeGet("_id/".concat(id), null), Map.class);
		return ParaObjectUtils.setAnnotatedFields(data);
	}
594407
public static synchronized boolean denyID(String id) {
		boolean rv = false;
		if(deniedID==null) {
			deniedID = new HashMap<String,Counter>();
			deniedID.put(id, new Counter(id)); // Noted duplicated for minimum time spent
			rv = true;
		} else if(deniedID.get(id)==null) {
			deniedID.put(id, new Counter(id));
			rv = true;
		}
		if(rv) {
			writeID();
		}
		return rv;

	}
545820
@Override
    public boolean getBoolean(@NonNull String key) {
        if (key == null) { throw new IllegalArgumentException("key cannot be null."); }

        synchronized (lock) {
            final Object obj = getMValue(internalDict, key).asNative(internalDict);
            return CBLConverter.asBoolean(obj);
        }
    }
585069
public static boolean getBoolean( String key, boolean def ) {
        String b = getProperty( key );
        if( b != null ) {
            def = b.toLowerCase().equals( "true" );
        }
        return def;
    }