public Builder setHasMultipleValues(boolean hasMultipleValues) { if (this.hasMultipleValues != null && this.hasMultipleValues != hasMultipleValues) { throw new IAE( "hasMultipleValues[%s] is already set, cannot change to[%s]", this.hasMultipleValues, hasMultipleValues ); } this.hasMultipleValues = hasMultipleValues; return this; }
private static void verifySize(String path, byte[] rawBytes, int maxZnodeBytes) { if (rawBytes.length > maxZnodeBytes) { throw new IAE( "Length of raw bytes for znode[%s] too large[%,d > %,d]", path, rawBytes.length, maxZnodeBytes ); } } }
public Builder setValueType(ValueType valueType) { if (this.valueType != null && this.valueType != valueType) { throw new IAE("valueType[%s] is already set, cannot change to[%s]", this.valueType, valueType); } this.valueType = valueType; return this; }
public static byte getNumBytesForMax(int maxValue) { if (maxValue < 0) { throw new IAE("maxValue[%s] must be positive", maxValue); } if (maxValue <= 0xFF) { return 1; } else if (maxValue <= 0xFFFF) { return 2; } else if (maxValue <= 0xFFFFFF) { return 3; } return 4; }
private static String getAvaticaConnectionId(Map<String, Object> requestMap) throws IOException { Object connectionIdObj = requestMap.get("connectionId"); if (connectionIdObj == null) { throw new IAE("Received an Avatica request without a connectionId."); } if (!(connectionIdObj instanceof String)) { throw new IAE("Received an Avatica request with a non-String connectionId."); } return (String) connectionIdObj; }
public InputRow formatRow(InputRow row) { for (Function<InputRow, InputRow> rowTransformer : rowTransformers) { row = rowTransformer.apply(row); } if (row == null) { throw new IAE("Row is null? How can this be?!"); } return row; }
public static String getString(Map<String, Object> in, String key, String defaultValue) { Object retVal = in.get(key); if (retVal == null) { if (defaultValue == null) { throw new IAE("Key[%s] is required in map[%s]", key, in); } return defaultValue; } return retVal.toString(); }
private static String convertValue(Object dimension, String name) { final String retVal; if (dimension instanceof String) { retVal = (String) dimension; } else if (dimension instanceof Map) { retVal = (String) ((Map) dimension).get(name); } else { throw new IAE("Unknown type[%s] for dimension[%s]", dimension.getClass(), dimension); } return retVal; }
private static String convertValue(Object metric) { final String retVal; if (metric instanceof String) { retVal = (String) metric; } else if (metric instanceof Map) { retVal = (String) ((Map) metric).get("metric"); } else { throw new IAE("Unknown type[%s] for metric[%s]", metric.getClass(), metric); } return retVal; }
public static <T> GenericIndexed<T> read(ByteBuffer buffer, ObjectStrategy<T> strategy) { byte versionFromBuffer = buffer.get(); if (VERSION_ONE == versionFromBuffer) { return createGenericIndexedVersionOne(buffer, strategy); } else if (VERSION_TWO == versionFromBuffer) { throw new IAE( "use read(ByteBuffer buffer, ObjectStrategy<T> strategy, SmooshedFileMapper fileMapper)" + " to read version 2 indexed." ); } throw new IAE("Unknown version[%d]", (int) versionFromBuffer); }
public void and(MutableBitmap mutableBitmap) { if (mutableBitmap instanceof WrappedBitSetBitmap) { WrappedBitSetBitmap bitSet = (WrappedBitSetBitmap) mutableBitmap; this.bitmap.and(bitSet.bitmap); } else { throw new IAE( "Unknown class type: %s expected %s", mutableBitmap.getClass().getCanonicalName(), WrappedBitSetBitmap.class.getCanonicalName() ); } }
@JsonCreator public QuantilePostAggregator( @JsonProperty("name") String name, @JsonProperty("fieldName") String fieldName, @JsonProperty("probability") float probability ) { super(name, fieldName); this.probability = probability; this.fieldName = fieldName; if (probability < 0 || probability > 1) { throw new IAE("Illegal probability[%s], must be strictly between 0 and 1", probability); } }
@Override public void or(MutableBitmap mutableBitmap) { if (mutableBitmap instanceof WrappedBitSetBitmap) { WrappedBitSetBitmap bitSet = (WrappedBitSetBitmap) mutableBitmap; this.bitmap.or(bitSet.bitmap); } else { throw new IAE( "Unknown class type: %s expected %s", mutableBitmap.getClass().getCanonicalName(), WrappedBitSetBitmap.class.getCanonicalName() ); } }
public S3Coords(URI uri) { if (!"s3".equalsIgnoreCase(uri.getScheme())) { throw new IAE("Unsupported scheme: [%s]", uri.getScheme()); } bucket = uri.getHost(); String path = uri.getPath(); if (path.startsWith("/")) { path = path.substring(1); } this.path = path; }
public static URI checkURI(URI uri) { if (uri.getScheme().equalsIgnoreCase(scheme)) { uri = URI.create("s3" + uri.toString().substring(scheme.length())); } else if (!uri.getScheme().equalsIgnoreCase("s3")) { throw new IAE("Don't know how to load scheme for URI [%s]", uri.toString()); } return uri; }
@Override public int get(int index) { if (index >= size) { throw new IAE("Index[%d] >= size[%d]", index, size); } return values.get(index + offset); }
@Override public DimensionAndMetricValueExtractor apply(@Nullable Object input) { if (input instanceof Map) { return new DimensionAndMetricValueExtractor((Map) input); } else if (input instanceof DimensionAndMetricValueExtractor) { return (DimensionAndMetricValueExtractor) input; } else { throw new IAE("Unknown type for input[%s]", input.getClass()); } } }
@Nullable public DateTime getMinTime() { if (value instanceof Map) { return getDateTimeValue(((Map) value).get(TimeBoundaryQuery.MIN_TIME)); } else { throw new IAE("MinTime not supported!"); } }
private static ComplexMetricSerde getComplexMetricSerde(String type) { ComplexMetricSerde serde = ComplexMetrics.getSerdeForType(type); if (serde == null) { throw new IAE("Unknown type[%s]", type); } return serde; } }
public static ArrayBasedIndexedInts of(int[] expansion, int size) { if (size == 0) { return EMPTY; } if (size < 0 || size > expansion.length) { throw new IAE("Size[%s] should be between 0 and %s", size, expansion.length); } return new ArrayBasedIndexedInts(expansion, size); }