// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.fasterxml.jackson.databind.deser.impl; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.util.NameTransformer; import java.io.IOException; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; public class BeanPropertyMap implements Iterable, Serializable { private static final long serialVersionUID = 2L; protected final boolean _caseInsensitive; private Object _hashArea[]; private int _hashMask; private SettableBeanProperty _propsInOrder[]; private int _size; private int _spillCount; public BeanPropertyMap(boolean flag, Collection collection) { _caseInsensitive = flag; _propsInOrder = (SettableBeanProperty[])collection.toArray(new SettableBeanProperty[collection.size()]); init(collection); } private final SettableBeanProperty _find2(String s, int i, Object obj) { if (obj != null) goto _L2; else goto _L1 _L1: return null; _L2: int j = _hashMask + 1; i = (i >> 1) + j << 1; obj = _hashArea[i]; if (s.equals(obj)) { return (SettableBeanProperty)_hashArea[i + 1]; } if (obj != null) { j = (j >> 1) + j << 1; int k = _spillCount; i = j; while (i < j + k) { obj = _hashArea[i]; if (obj == s || s.equals(obj)) { return (SettableBeanProperty)_hashArea[i + 1]; } i += 2; } } if (true) goto _L1; else goto _L3 _L3: } private int _findFromOrdered(SettableBeanProperty settablebeanproperty) { int i = 0; for (int j = _propsInOrder.length; i < j; i++) { if (_propsInOrder[i] == settablebeanproperty) { return i; } } throw new IllegalStateException((new StringBuilder()).append("Illegal state: property '").append(settablebeanproperty.getName()).append("' missing from _propsInOrder").toString()); } private final int _hashCode(String s) { return s.hashCode() & _hashMask; } public static BeanPropertyMap construct(Collection collection, boolean flag) { return new BeanPropertyMap(flag, collection); } private static final int findSize(int i) { if (i > 5) goto _L2; else goto _L1 _L1: byte byte0 = 8; _L4: return byte0; _L2: if (i <= 12) { return 16; } int j = 32; do { byte0 = j; if (j >= i + (i >> 2)) { continue; } j += j; } while (true); if (true) goto _L4; else goto _L3 _L3: } private List properties() { ArrayList arraylist = new ArrayList(_size); int i = 1; for (int j = _hashArea.length; i < j; i += 2) { SettableBeanProperty settablebeanproperty = (SettableBeanProperty)_hashArea[i]; if (settablebeanproperty != null) { arraylist.add(settablebeanproperty); } } return arraylist; } protected SettableBeanProperty _rename(SettableBeanProperty settablebeanproperty, NameTransformer nametransformer) { if (settablebeanproperty == null) { return settablebeanproperty; } SettableBeanProperty settablebeanproperty1 = settablebeanproperty.withSimpleName(nametransformer.transform(settablebeanproperty.getName())); JsonDeserializer jsondeserializer = settablebeanproperty1.getValueDeserializer(); settablebeanproperty = settablebeanproperty1; if (jsondeserializer != null) { nametransformer = jsondeserializer.unwrappingDeserializer(nametransformer); settablebeanproperty = settablebeanproperty1; if (nametransformer != jsondeserializer) { settablebeanproperty = settablebeanproperty1.withValueDeserializer(nametransformer); } } return settablebeanproperty; } public BeanPropertyMap assignIndexes() { int j = 1; int l = _hashArea.length; int i = 0; for (; j < l; j += 2) { SettableBeanProperty settablebeanproperty = (SettableBeanProperty)_hashArea[j]; if (settablebeanproperty != null) { int k = i + 1; settablebeanproperty.assignIndex(i); i = k; } } return this; } public SettableBeanProperty find(int i) { int j = 1; for (int k = _hashArea.length; j < k; j += 2) { SettableBeanProperty settablebeanproperty = (SettableBeanProperty)_hashArea[j]; if (settablebeanproperty != null && i == settablebeanproperty.getPropertyIndex()) { return settablebeanproperty; } } return null; } public SettableBeanProperty find(String s) { if (s == null) { throw new IllegalArgumentException("Can not pass null property name"); } String s1 = s; if (_caseInsensitive) { s1 = s.toLowerCase(); } int i = s1.hashCode() & _hashMask; int j = i << 1; s = ((String) (_hashArea[j])); if (s == s1 || s1.equals(s)) { return (SettableBeanProperty)_hashArea[j + 1]; } else { return _find2(s1, i, s); } } public boolean findDeserializeAndSet(JsonParser jsonparser, DeserializationContext deserializationcontext, Object obj, String s) throws IOException { SettableBeanProperty settablebeanproperty = find(s); if (settablebeanproperty == null) { return false; } try { settablebeanproperty.deserializeAndSet(jsonparser, deserializationcontext, obj); } // Misplaced declaration of an exception variable catch (JsonParser jsonparser) { wrapAndThrow(jsonparser, obj, s, deserializationcontext); } return true; } public SettableBeanProperty[] getPropertiesInInsertionOrder() { return _propsInOrder; } protected final String getPropertyName(SettableBeanProperty settablebeanproperty) { if (_caseInsensitive) { return settablebeanproperty.getName().toLowerCase(); } else { return settablebeanproperty.getName(); } } protected void init(Collection collection) { _size = collection.size(); int k1 = findSize(_size); _hashMask = k1 - 1; Object aobj[] = new Object[((k1 >> 1) + k1) * 2]; int k = 0; Iterator iterator1 = collection.iterator(); collection = ((Collection) (aobj)); do { if (!iterator1.hasNext()) { break; } SettableBeanProperty settablebeanproperty = (SettableBeanProperty)iterator1.next(); if (settablebeanproperty != null) { String s = getPropertyName(settablebeanproperty); int l1 = _hashCode(s); int l = l1 << 1; Object obj = collection; int i = l; int j = k; if (collection[l] != null) { int i1 = (l1 >> 1) + k1 << 1; obj = collection; i = i1; j = k; if (collection[i1] != null) { int j1 = ((k1 >> 1) + k1 << 1) + k; k += 2; obj = collection; i = j1; j = k; if (j1 >= collection.length) { obj = ((Object) (Arrays.copyOf(collection, collection.length + 4))); j = k; i = j1; } } } obj[i] = s; obj[i + 1] = settablebeanproperty; collection = ((Collection) (obj)); k = j; } } while (true); _hashArea = collection; _spillCount = k; } public Iterator iterator() { return properties().iterator(); } public void remove(SettableBeanProperty settablebeanproperty) { ArrayList arraylist; String s; int i; int j; boolean flag1; arraylist = new ArrayList(_size); s = getPropertyName(settablebeanproperty); flag1 = false; i = 1; j = _hashArea.length; _L2: SettableBeanProperty settablebeanproperty1; boolean flag; if (i >= j) { break MISSING_BLOCK_LABEL_130; } settablebeanproperty1 = (SettableBeanProperty)_hashArea[i]; if (settablebeanproperty1 != null) { break; /* Loop/switch isn't completed */ } flag = flag1; _L3: i += 2; flag1 = flag; if (true) goto _L2; else goto _L1 _L1: label0: { flag = flag1; if (flag1) { break label0; } flag1 = s.equals(settablebeanproperty1.getName()); flag = flag1; if (!flag1) { break label0; } _propsInOrder[_findFromOrdered(settablebeanproperty1)] = null; flag = flag1; } goto _L3 arraylist.add(settablebeanproperty1); goto _L3 if (!flag1) { throw new NoSuchElementException((new StringBuilder()).append("No entry '").append(settablebeanproperty.getName()).append("' found, can't remove").toString()); } else { init(arraylist); return; } } public BeanPropertyMap renameAll(NameTransformer nametransformer) { if (nametransformer == null || nametransformer == NameTransformer.NOP) { return this; } int j = _propsInOrder.length; ArrayList arraylist = new ArrayList(j); int i = 0; while (i < j) { SettableBeanProperty settablebeanproperty = _propsInOrder[i]; if (settablebeanproperty == null) { arraylist.add(settablebeanproperty); } else { arraylist.add(_rename(settablebeanproperty, nametransformer)); } i++; } return new BeanPropertyMap(_caseInsensitive, arraylist); } public void replace(SettableBeanProperty settablebeanproperty) { String s = getPropertyName(settablebeanproperty); int i = 1; for (int j = _hashArea.length; i < j; i += 2) { SettableBeanProperty settablebeanproperty1 = (SettableBeanProperty)_hashArea[i]; if (settablebeanproperty1 != null && settablebeanproperty1.getName().equals(s)) { _hashArea[i] = settablebeanproperty; _propsInOrder[_findFromOrdered(settablebeanproperty1)] = settablebeanproperty; return; } } throw new NoSuchElementException((new StringBuilder()).append("No entry '").append(settablebeanproperty.getName()).append("' found, can't replace").toString()); } public int size() { return _size; } public String toString() { StringBuilder stringbuilder = new StringBuilder(); stringbuilder.append("Properties=["); int i = 0; for (Iterator iterator1 = iterator(); iterator1.hasNext();) { SettableBeanProperty settablebeanproperty = (SettableBeanProperty)iterator1.next(); if (i > 0) { stringbuilder.append(", "); } stringbuilder.append(settablebeanproperty.getName()); stringbuilder.append('('); stringbuilder.append(settablebeanproperty.getType()); stringbuilder.append(')'); i++; } stringbuilder.append(']'); return stringbuilder.toString(); } public BeanPropertyMap withProperty(SettableBeanProperty settablebeanproperty) { String s = getPropertyName(settablebeanproperty); int i = 1; for (int j = _hashArea.length; i < j; i += 2) { SettableBeanProperty settablebeanproperty1 = (SettableBeanProperty)_hashArea[i]; if (settablebeanproperty1 != null && settablebeanproperty1.getName().equals(s)) { _hashArea[i] = settablebeanproperty; _propsInOrder[_findFromOrdered(settablebeanproperty1)] = settablebeanproperty; return this; } } int k1 = _hashCode(s); int j1 = _hashMask + 1; int k = k1 << 1; i = k; if (_hashArea[k] != null) { int l = (k1 >> 1) + j1 << 1; i = l; if (_hashArea[l] != null) { int i1 = ((j1 >> 1) + j1 << 1) + _spillCount; _spillCount = _spillCount + 2; i = i1; if (i1 >= _hashArea.length) { _hashArea = Arrays.copyOf(_hashArea, _hashArea.length + 4); i = i1; } } } _hashArea[i] = s; _hashArea[i + 1] = settablebeanproperty; i = _propsInOrder.length; _propsInOrder = (SettableBeanProperty[])Arrays.copyOf(_propsInOrder, i + 1); _propsInOrder[i] = settablebeanproperty; return this; } protected void wrapAndThrow(Throwable throwable, Object obj, String s, DeserializationContext deserializationcontext) throws IOException { for (; (throwable instanceof InvocationTargetException) && throwable.getCause() != null; throwable = throwable.getCause()) { } if (throwable instanceof Error) { throw (Error)throwable; } boolean flag; if (deserializationcontext == null || deserializationcontext.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS)) { flag = true; } else { flag = false; } if (throwable instanceof IOException) { if (!flag || !(throwable instanceof JsonProcessingException)) { throw (IOException)throwable; } } else if (!flag && (throwable instanceof RuntimeException)) { throw (RuntimeException)throwable; } throw JsonMappingException.wrapWithPath(throwable, obj, s); } }