@Override public boolean equals (Object obj) { if (this == obj) return true; if (null == obj) return false; if (!(obj instanceof TypeDescriptor)) return false; TypeDescriptor that = (TypeDescriptor) obj; if (!_mainType.equals(that._mainType)) return false; int thisSize = (null == this._genericTypes ? 0 : this._genericTypes.size()); int thatSize = (null == that._genericTypes ? 0 : that._genericTypes.size()); if (thisSize != thatSize) return false; for (int i = 0; i < thisSize; ++i) { if (!this._genericTypes.get(i).equals(that._genericTypes.get(i))) return false; } return true; }
if ( expandedExpectedBinClass.equals(numberDescriptor) ) { result = serializerBinTypeDescriptor.equals(byteDescriptor) || serializerBinTypeDescriptor.equals(shortDescriptor) || serializerBinTypeDescriptor.equals(integerDescriptor) || serializerBinTypeDescriptor.equals(longDescriptor) || serializerBinTypeDescriptor.equals(atomicIntegerDescriptor) || serializerBinTypeDescriptor.equals(atomicLongDescriptor) || serializerBinTypeDescriptor.equals(floatDescriptor) || serializerBinTypeDescriptor.equals(doubleDescriptor) || serializerBinTypeDescriptor.equals(bigIntegerDescriptor) || serializerBinTypeDescriptor.equals(bigDecimalDescriptor); } else if ( expandedExpectedBinClass.equals(listNumberDescriptor) ) { TypeDescriptor bigDecimalListDescriptor = new TypeDescriptor(List.class, bigDecimalDescriptor); result = serializerBinTypeDescriptor.equals(byteListDescriptor) || serializerBinTypeDescriptor.equals(shortListDescriptor) || serializerBinTypeDescriptor.equals(integerListDescriptor) || serializerBinTypeDescriptor.equals(longListDescriptor) || serializerBinTypeDescriptor.equals(atomicIntegerListDescriptor) || serializerBinTypeDescriptor.equals(atomicLongListDescriptor) || serializerBinTypeDescriptor.equals(floatListDescriptor) || serializerBinTypeDescriptor.equals(doubleListDescriptor) || serializerBinTypeDescriptor.equals(bigIntegerListDescriptor) || serializerBinTypeDescriptor.equals(bigDecimalListDescriptor);
/** * All this method does is check the return type of a serializer * programatically, As such, it supercedes the warnings hidden here. * * It will only work, of course, if the serializer is set up correctly * (i.e., without lying about its type_, and if the pass-ed class and * expandedClass actually match; mis-use will, of course, cause errors. */ @SuppressWarnings({"unchecked", "rawtypes"}) public static <T> TileSerializer<T> checkBinClass (TileSerializer<?> serializer, Class<T> expectedBinClass, TypeDescriptor expandedExpectedBinClass) throws ConfigurationException { if (null == serializer) { throw new ConfigurationException("No serializer given for renderer"); } if ( !expandedExpectedBinClass.equals(serializer.getBinTypeDescription()) && !serializerTypeCompatibleToNumber( serializer, expandedExpectedBinClass )) { throw new ConfigurationException("Serialization type does not match rendering type. Serialization class was "+serializer.getBinTypeDescription()+", renderer type was "+expandedExpectedBinClass); } return (TileSerializer) serializer; }