private final boolean _isJSONFactory() { // NOTE: since we only really care about whether this is standard JSON-backed factory, // or its sub-class / delegated to one, no need to check for equality, identity is enough return getFormatName() == FORMAT_NAME_JSON; } }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFormatName(); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append('['); final int len = _detectors.length; if (len > 0) { sb.append(_detectors[0].getFormatName()); for (int i = 1; i < len; ++i) { sb.append(", "); sb.append(_detectors[i].getFormatName()); } } sb.append(']'); return sb.toString(); }
/** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_generatorFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Cannot use FormatSchema of type "+schema.getClass().getName() +" for format "+_generatorFactory.getFormatName()); } } }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFactory().getFormatName(); }
/** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_parserFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Cannot use FormatSchema of type "+schema.getClass().getName() +" for format "+_parserFactory.getFormatName()); } } }
/** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_jsonFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Cannot use FormatSchema of type "+schema.getClass().getName() +" for format "+_jsonFactory.getFormatName()); } } } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append('['); final int len = _readers.length; if (len > 0) { sb.append(_readers[0].getFactory().getFormatName()); for (int i = 1; i < len; ++i) { sb.append(", "); sb.append(_readers[i].getFactory().getFormatName()); } } sb.append(']'); return sb.toString(); }
/** * Method that can be used to quickly check whether given schema * is something that parsers and/or generators constructed by this * factory could use. Note that this means possible use, at the level * of data format (i.e. schema is for same data format as parsers and * generators this factory constructs); individual schema instances * may have further usage restrictions. * * @since 2.1 */ public boolean canUseSchema(FormatSchema schema) { if (schema == null){ return false; } String ourFormat = getFormatName(); return (ourFormat != null) && ourFormat.equals(schema.getSchemaType()); }
/** * Helper method called to work around the problem of this class both defining * general API for constructing parsers+generators AND implementing the API * for JSON handling. Problem here is that when adding new functionality * via factory methods, it is not possible to leave these methods abstract * (because we are implementing them for JSON); but there is risk that * sub-classes do not override them all (plus older version can not implement). * So a work-around is to add a check to ensure that factory is still one * used for JSON; and if not, make base implementation of a factory method fail. * * @since 2.9 */ private final void _requireJSONFactory(String msg) { if (!_isJSONFactory()) { throw new UnsupportedOperationException(String.format(msg, getFormatName())); } }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFormatName(); }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFormatName(); }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFormatName(); }
/** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_generatorFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName() +" for format "+_generatorFactory.getFormatName()); } } }
/** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_generatorFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName() +" for format "+_generatorFactory.getFormatName()); } } }
/** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_parserFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName() +" for format "+_parserFactory.getFormatName()); } } }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFactory().getFormatName(); }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFactory().getFormatName(); }
/** * @since 2.2 */ protected void _verifySchemaType(FormatSchema schema) { if (schema != null) { if (!_parserFactory.canUseSchema(schema)) { throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName() +" for format "+_parserFactory.getFormatName()); } } }
/** * Accessor for getting brief textual name of matched format if any (null * if none). Equivalent to: *<pre> * return hasMatch() ? getMatch().getFormatName() : null; *</pre> */ public String getMatchedFormatName() { return _match.getFactory().getFormatName(); }