protected T getTypedValue()

in core/src/main/java/org/hibernate/ogm/util/configurationreader/impl/SimplePropertyReaderContext.java [40:75]


	protected T getTypedValue() {
		T typedValue;
		Class<T> targetType = getTargetType();

		if ( targetType == String.class ) {
			typedValue = (T) getAsString();
		}
		else if ( targetType == boolean.class ) {
			typedValue = (T) getAsPrimitiveBoolean();
		}
		else if ( targetType == int.class ) {
			typedValue = (T) getAsInt();
		}
		else if ( targetType == Integer.class ) {
			typedValue = (T) getAsInteger();
		}
		else if ( targetType == long.class ) {
			typedValue = (T) getAsLong();
		}
		else if ( targetType == Long.class ) {
			typedValue = (T) getAsLong();
		}
		else if ( targetType.isEnum() ) {
			typedValue = (T) getAsEnum();
		}
		else if ( targetType == URL.class ) {
			typedValue = (T) getAsUrl();
		}
		else if ( targetType == Boolean.class ) {
			typedValue = (T) getAsBoolean();
		}
		else {
			throw log.unsupportedPropertyType( getPropertyName(), getConfiguredValue() == null ? "null" : getConfiguredValue().toString() );
		}
		return typedValue;
	}