public boolean isMethodOf(Method method) { for ( int i = 0; i < propertySpan; i++ ) { final Method getterMethod = getters[i].getMethod(); if ( getterMethod != null && getterMethod.equals( method ) ) { return true; } } return false; }
@Test public void happyCase() { final UserAccessor accessor = new UserAccessor(); final Getter getter = accessor.getGetter(TestObject.class, PropertyHelper.MODIFIED_BY); assertNotNull(getter); assertNull("getMethod", getter.getMethod()); assertNull("getMethodName", getter.getMethodName()); }
public boolean isMethodOf(Method method) { for ( int i=0; i<propertySpan; i++ ) { final Method getterMethod = getters[i].getMethod(); if ( getterMethod!=null && getterMethod.equals(method) ) return true; } return false; }
@Ignore("need to convert, was originally written for the old value holder design (TextString, etc)") @Test public void happyCase() { obj.setString(expected); NakedPropertyAccessor accessor = new NakedPropertyAccessor(); Getter getter = accessor.getGetter(SimpleObject.class, "string"); assertNotNull(getter); assertNull("getMethod", getter.getMethod()); assertNull("getMethodName", getter.getMethodName()); assertEquals("return type", String.class, getter.getReturnType()); }
public boolean isMethodOf(Method method) { for ( int i = 0; i < propertySpan; i++ ) { final Method getterMethod = getters[i].getMethod(); if ( getterMethod != null && getterMethod.equals( method ) ) { return true; } } return false; }
private Method getGetterFor(String property) { Class cl = this.metadata.getMappedClass(EntityMode.POJO); Getter getter = ReflectHelper.getGetter(cl, property); return getter.getMethod(); }
Method idGetterMethod = idGetter==null ? null : idGetter.getMethod(); Method idSetterMethod = idSetter==null ? null : idSetter.getMethod();
while ( properties.hasNext() ) { Property property = (Property) properties.next(); Method method = property.getGetter(clazz).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { LOG.gettersOfLazyClassesCannotBeFinal(persistentClass.getEntityName(), property.getName()); Method idGetterMethod = idGetter==null ? null : idGetter.getMethod(); Method idSetterMethod = idSetter==null ? null : idSetter.getMethod();
while ( properties.hasNext() ) { Property property = (Property) properties.next(); Method method = property.getGetter(clazz).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { LOG.gettersOfLazyClassesCannotBeFinal(persistentClass.getEntityName(), property.getName()); Method idGetterMethod = idGetter==null ? null : idGetter.getMethod(); Method idSetterMethod = idSetter==null ? null : idSetter.getMethod();
Method method = getGetter( property ).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { LOG.gettersOfLazyClassesCannotBeFinal(entityBinding.getEntity().getName(), property.getAttribute().getName()); Method idGetterMethod = idGetter==null ? null : idGetter.getMethod(); Method idSetterMethod = idSetter==null ? null : idSetter.getMethod();
Method method = getGetter( property ).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { LOG.gettersOfLazyClassesCannotBeFinal(entityBinding.getEntity().getName(), property.getAttribute().getName()); Method idGetterMethod = idGetter==null ? null : idGetter.getMethod(); Method idSetterMethod = idSetter==null ? null : idSetter.getMethod();
public static GroovyAwareJavassistProxyFactory buildProxyFactory(PersistentClass persistentClass) { GroovyAwareJavassistProxyFactory proxyFactory = new GroovyAwareJavassistProxyFactory(); @SuppressWarnings("unchecked") Set<Class<HibernateProxy>> proxyInterfaces = CollectionUtils.newSet(HibernateProxy.class); final Class<?> javaClass = persistentClass.getMappedClass(); final Property identifierProperty = persistentClass.getIdentifierProperty(); final Getter idGetter = identifierProperty!=null? identifierProperty.getGetter(javaClass) : null; final Setter idSetter = identifierProperty!=null? identifierProperty.getSetter(javaClass) : null; if (idGetter == null || idSetter == null) return null; try { proxyFactory.postInstantiate(persistentClass.getEntityName(), javaClass, proxyInterfaces, idGetter.getMethod(), idSetter.getMethod(), persistentClass.hasEmbeddedIdentifier() ? (CompositeType) persistentClass.getIdentifier().getType() : null); } catch (HibernateException e) { LOG.warn("Cannot instantiate proxy factory: " + e.getMessage()); return null; } return proxyFactory; }