Java Code Examples for org.hibernate.usertype.DynamicParameterizedType#ParameterType
The following examples show how to use
org.hibernate.usertype.DynamicParameterizedType#ParameterType .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnumArrayType.java From hibernate-types with Apache License 2.0 | 6 votes |
@Override public void setParameterValues(Properties parameters) { DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE); Annotation[] annotations = parameterType.getAnnotationsMethod(); if (annotations != null) { for (int i = 0; i < annotations.length; i++) { Annotation annotation = annotations[i]; if (Type.class.isAssignableFrom(annotation.annotationType())) { Type type = (Type) annotation; name = type.type(); break; } } } if (name == null) { name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE)); } ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters); }
Example 2
Source File: EnumArrayType.java From hibernate-types with Apache License 2.0 | 6 votes |
@Override public void setParameterValues(Properties parameters) { DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE); Annotation[] annotations = parameterType.getAnnotationsMethod(); if (annotations != null) { for (int i = 0; i < annotations.length; i++) { Annotation annotation = annotations[i]; if (Type.class.isAssignableFrom(annotation.annotationType())) { Type type = (Type) annotation; name = type.type(); break; } } } if (name == null) { name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE)); } ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters); }
Example 3
Source File: EnumArrayType.java From hibernate-types with Apache License 2.0 | 6 votes |
@Override public void setParameterValues(Properties parameters) { DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE); Annotation[] annotations = parameterType.getAnnotationsMethod(); if (annotations != null) { for (int i = 0; i < annotations.length; i++) { Annotation annotation = annotations[i]; if (Type.class.isAssignableFrom(annotation.annotationType())) { Type type = (Type) annotation; name = type.type(); break; } } } if (name == null) { name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE)); } ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters); }
Example 4
Source File: EnumArrayType.java From hibernate-types with Apache License 2.0 | 6 votes |
@Override public void setParameterValues(Properties parameters) { DynamicParameterizedType.ParameterType parameterType = (ParameterType) parameters.get(DynamicParameterizedType.PARAMETER_TYPE); Annotation[] annotations = parameterType.getAnnotationsMethod(); if (annotations != null) { for (int i = 0; i < annotations.length; i++) { Annotation annotation = annotations[i]; if (Type.class.isAssignableFrom(annotation.annotationType())) { Type type = (Type) annotation; name = type.type(); break; } } } if (name == null) { name = String.format(DEFAULT_TYPE_NAME, parameters.getProperty(SQL_ARRAY_TYPE)); } ((AbstractArrayTypeDescriptor) getJavaTypeDescriptor()).setParameterValues(parameters); }
Example 5
Source File: JSONType.java From spring-data-jpa-extra with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public void setParameterValues(Properties parameters) { try { Class eClass = ReflectHelper.classForName(parameters.getProperty(DynamicParameterizedType.ENTITY)); Field field = ReflectionUtils.findField(eClass, parameters.getProperty(DynamicParameterizedType.PROPERTY)); Type fieldType = field.getGenericType(); if (fieldType instanceof Class || fieldType instanceof ParameterizedType) { type = fieldType; } parseSqlType(field.getAnnotations()); return; } catch (Exception e) { LOG.error(e.getMessage()); } final DynamicParameterizedType.ParameterType reader = (DynamicParameterizedType.ParameterType) parameters.get( DynamicParameterizedType.PARAMETER_TYPE); if (reader != null) { type = reader.getReturnedClass(); parseSqlType(reader.getAnnotationsMethod()); } else { try { type = ReflectHelper.classForName((String) parameters.get(CLASS_NAME)); } catch (ClassNotFoundException exception) { throw new HibernateException("class not found", exception); } } }