當前位置: 首頁>>代碼示例>>Java>>正文


Java Entity.name方法代碼示例

本文整理匯總了Java中javax.persistence.Entity.name方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.name方法的具體用法?Java Entity.name怎麽用?Java Entity.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.persistence.Entity的用法示例。


在下文中一共展示了Entity.name方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: bindEjb3Annotation

import javax.persistence.Entity; //導入方法依賴的package包/類
private void bindEjb3Annotation(Entity ejb3Ann) {
	if ( ejb3Ann == null ) throw new AssertionFailure( "@Entity should always be not null" );
	if ( BinderHelper.isEmptyAnnotationValue( ejb3Ann.name() ) ) {
		name = StringHelper.unqualify( annotatedClass.getName() );
	}
	else {
		name = ejb3Ann.name();
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:EntityBinder.java

示例2: getTableName

import javax.persistence.Entity; //導入方法依賴的package包/類
private String getTableName(PersistentEntity entity) {
	if (entity.getClass().isAnnotationPresent(Entity.class)) {
		Entity annotation = entity.getClass().getAnnotation(Entity.class);
		return annotation.name();
	}
	throw new IllegalStateException(entity.getClass().getSimpleName() + " must have an @Entity annotation configured with the entity name.");
}
 
開發者ID:PatternFM,項目名稱:tokamak,代碼行數:8,代碼來源:UniqueValueValidator.java

示例3: getEntityAnnotationName

import javax.persistence.Entity; //導入方法依賴的package包/類
public String getEntityAnnotationName(Class<?> clazz) {
    try {
        Entity entityAnnotation = clazz.getAnnotation(Entity.class);
        return StringHelper.isEmpty(entityAnnotation.name()) ? clazz.getSimpleName() : entityAnnotation.name();
    } catch (Exception e) {
        return clazz.getSimpleName();
    }
}
 
開發者ID:xiaolongzuo,項目名稱:niubi-job,代碼行數:9,代碼來源:BaseDaoImpl.java

示例4: getTableName

import javax.persistence.Entity; //導入方法依賴的package包/類
/**
 * Get table name.
 * 
 * 
 * @return name Entity annotation or class name if entity annotation is not
 *         defined
 */
public static String getTableName(final Table table) {
    Entity entityAnno = table.getTableClass().getAnnotation(Entity.class);
    if (entityAnno != null && !entityAnno.name().isEmpty()) {
        return entityAnno.name();
    }
    return table.getTableClass().getSimpleName();
}
 
開發者ID:herolynx,項目名稱:jsql,代碼行數:15,代碼來源:GrammarUtil.java

示例5: getEntityName

import javax.persistence.Entity; //導入方法依賴的package包/類
private String getEntityName(Identifiable<?> entity) {
    Entity entityAnnotation = findAnnotation(entity.getClass(), Entity.class);
    if (isBlank(entityAnnotation.name())) {
        return getClassWithoutInitializingProxy(entity).getSimpleName();
    }
    return entityAnnotation.name();
}
 
開發者ID:ddRPB,項目名稱:rpb,代碼行數:8,代碼來源:JpaUniqueUtil.java

示例6: getTableName

import javax.persistence.Entity; //導入方法依賴的package包/類
public <T> String getTableName() {
	Table table = clazz.getAnnotation(Table.class);
	if (table != null && table.name() != null)
		return table.name();
	Entity entity = clazz.getAnnotation(Entity.class);
	if ( entity != null && (!entity.name().isEmpty()) )
		return entity.name();
	return clazz.getSimpleName();
}
 
開發者ID:ctripcorp,項目名稱:dal,代碼行數:10,代碼來源:EntityManager.java

示例7: getEntityName

import javax.persistence.Entity; //導入方法依賴的package包/類
@Override
public String getEntityName(Class<T> entityClass) {
	String entityname = entityClass.getSimpleName();
	Entity entity = entityClass.getAnnotation(Entity.class);
	if(entity.name()!=null && !"".equals(entity.name())){
	entityname = entity.name();
	}
	return entityname;
}
 
開發者ID:pengqiuyuan,項目名稱:g2,代碼行數:10,代碼來源:GenericRepositoryImpl.java

示例8: getEntityName

import javax.persistence.Entity; //導入方法依賴的package包/類
protected String getEntityName(Class<?> clazz) {
    Entity entity = clazz.getAnnotation(Entity.class);

    // Check if the property name has been defined for Entity annotation
    if (entity != null && !entity.name().equals("")) {
        return entity.name();
    } else {
        return null;
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:11,代碼來源:JpaPollingConsumer.java

示例9: getEntityName

import javax.persistence.Entity; //導入方法依賴的package包/類
protected static String getEntityName(Class<?> clazz) {

        Entity entity = clazz.getAnnotation(Entity.class);

        // Check if the property name has been defined for Entity annotation
        if (!entity.name().equals("")) {
            return entity.name();
        } else {
            return null;
        }

    }
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:13,代碼來源:QueryUtils.java

示例10: getEntityName

import javax.persistence.Entity; //導入方法依賴的package包/類
/**
 * 獲取實體名稱
 */
protected <T> String getEntityName(Class<T> entityClass) {
    String enetityName = entityClass.getName();
    Entity entity = entityClass.getAnnotation(Entity.class);
    if (entity.name() != null && !"".equals(entity.name())) {
        enetityName = entity.name();
    }
    return enetityName;
}
 
開發者ID:sdgas,項目名稱:contract,代碼行數:12,代碼來源:DaoSupport.java

示例11: getEntityName

import javax.persistence.Entity; //導入方法依賴的package包/類
private String getEntityName(Class<?> clazz) {
  if (!clazz.isAnnotationPresent(Entity.class)) {
    return clazz.getSimpleName();
  }
  final Entity entity = clazz.getAnnotation(Entity.class);
  if (entity.name().isEmpty()) {
    return clazz.getSimpleName();
  }
  return entity.name();
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:11,代碼來源:JpaTckRepository.java

示例12: bindEntity

import javax.persistence.Entity; //導入方法依賴的package包/類
/**
 * Add given Entity bean to dictionary.
 *
 * @param cls Entity bean class
 */
public void bindEntity(Class<?> cls) {
    if (entityBindings.containsKey(lookupEntityClass(cls))) {
        return;
    }

    Annotation annotation = getFirstAnnotation(cls, Arrays.asList(Include.class, Exclude.class));
    Include include = annotation instanceof Include ? (Include) annotation : null;
    Exclude exclude = annotation instanceof Exclude ? (Exclude) annotation : null;
    Entity entity = (Entity) getFirstAnnotation(cls, Arrays.asList(Entity.class));

    if (exclude != null) {
        log.trace("Exclude {}", cls.getName());
        return;
    }

    if (include == null) {
        log.trace("Missing include {}", cls.getName());
        return;
    }

    String name;
    if (entity == null || "".equals(entity.name())) {
        name = StringUtils.uncapitalize(cls.getSimpleName());
    } else {
        name = entity.name();
    }

    String type;
    if ("".equals(include.type())) {
        type = name;
    } else {
        type = include.type();
    }

    Class<?> duplicate = bindJsonApiToEntity.put(type, cls);
    if (duplicate != null && !duplicate.equals(cls)) {
        log.error("Duplicate binding {} for {}, {}", type, cls, duplicate);
        throw new DuplicateMappingException(type + " " + cls.getName() + ":" + duplicate.getName());
    }

    entityBindings.putIfAbsent(lookupEntityClass(cls), new EntityBinding(this, cls, type, name));
    if (include.rootLevel()) {
        bindEntityRoots.add(cls);
    }
}
 
開發者ID:yahoo,項目名稱:elide,代碼行數:51,代碼來源:EntityDictionary.java


注:本文中的javax.persistence.Entity.name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。