org.hibernate.mapping.Property.getAccessorPropertyName()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.hibernate.mapping.Property.getAccessorPropertyName()方法的一些代码示例,展示了Property.getAccessorPropertyName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getAccessorPropertyName()方法的具体详情如下:
包路径:org.hibernate.mapping.Property
类名称:Property
方法名:getAccessorPropertyName

Property.getAccessorPropertyName介绍

暂无

代码示例

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

/**
 * Retrieves a PropertyAccessor instance based on the given property definition and
 * entity mode.
 *
 * @param property The property for which to retrieve an accessor.
 * @param mode The mode for the resulting entity.
 * @return An appropriate accessor.
 * @throws MappingException
 */
public static PropertyAccessor getPropertyAccessor(Property property, EntityMode mode) throws MappingException {
  //TODO: this is temporary in that the end result will probably not take a Property reference per-se.
  if ( null == mode || EntityMode.POJO.equals( mode ) ) {
    return getPojoPropertyAccessor( property.getPropertyAccessorName() );
  }
  else if ( EntityMode.MAP.equals( mode ) ) {
    return getDynamicMapPropertyAccessor();
  }
  else if ( EntityMode.DOM4J.equals( mode ) ) {
    //TODO: passing null here, because this method is not really used for DOM4J at the moment
    //      but it is still a bug, if we don't get rid of this!
    return getDom4jPropertyAccessor( property.getAccessorPropertyName( mode ), property.getType(), null );
  }
  else {
    throw new MappingException( "Unknown entity mode [" + mode + "]" );
  }
}    /**
 * Retreives a PropertyAccessor specific for a PojoRepresentation with the given access strategy.

代码示例来源:origin: hibernate/hibernate

/**
 * Retrieves a PropertyAccessor instance based on the given property definition and
 * entity mode.
 *
 * @param property The property for which to retrieve an accessor.
 * @param mode The mode for the resulting entity.
 * @return An appropriate accessor.
 * @throws MappingException
 */
public static PropertyAccessor getPropertyAccessor(Property property, EntityMode mode) throws MappingException {
  //TODO: this is temporary in that the end result will probably not take a Property reference per-se.
  if ( null == mode || EntityMode.POJO.equals( mode ) ) {
    return getPojoPropertyAccessor( property.getPropertyAccessorName() );
  }
  else if ( EntityMode.MAP.equals( mode ) ) {
    return getDynamicMapPropertyAccessor();
  }
  else if ( EntityMode.DOM4J.equals( mode ) ) {
    //TODO: passing null here, because this method is not really used for DOM4J at the moment
    //      but it is still a bug, if we don't get rid of this!
    return getDom4jPropertyAccessor( property.getAccessorPropertyName( mode ), property.getType(), null );
  }
  else {
    throw new MappingException( "Unknown entity mode [" + mode + "]" );
  }
}    /**
 * Retreives a PropertyAccessor specific for a PojoRepresentation with the given access strategy.

相关文章

微信公众号

最新文章

更多