下面列出了怎么用javax.persistence.EnumType的API类实例代码及写法,或者点击链接到github查看源代码。
public static void checkEnum(List<Class<?>> classes) throws Exception {
for (Class<?> cls : classes) {
List<Field> fields = FieldUtils.getFieldsListWithAnnotation(cls, FieldDescribe.class);
for (Field field : fields) {
if (field.getType().isEnum()) {
Enumerated enumerated = field.getAnnotation(Enumerated.class);
Column column = field.getAnnotation(Column.class);
if (null == enumerated || (!Objects.equals(EnumType.STRING, enumerated.value())) || (null == column)
|| column.length() > 200) {
System.err.println(String.format("checkEnum error: class: %s, field: %s.", cls.getName(),
field.getName()));
}
}
}
}
}
/** -> Gantt */
@Deprecated
@Enumerated(EnumType.STRING)
@Column(name = "gantt_rel_type", length = 15)
public GanttRelationType getGanttRelationType()
{
return ganttRelationType;
}
/**
* Adds a @MapKeyEnumerated annotation to the specified annotationList if the specified element
* contains a map-key-enumerated sub-element. This should only be the case for
* element-collection, many-to-many, or one-to-many associations.
*/
private void getMapKeyEnumerated(List<Annotation> annotationList, Element element) {
Element subelement = element != null ? element.element( "map-key-enumerated" ) : null;
if ( subelement != null ) {
AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyEnumerated.class );
EnumType value = EnumType.valueOf( subelement.getTextTrim() );
ad.setValue( "value", value );
annotationList.add( AnnotationFactory.create( ad ) );
}
}
/**
* @return the status
*/
@Enumerated(EnumType.STRING)
@Column(length = 100)
public TeamAttendeeStatus getStatus()
{
return status;
}
/**
* Gets the org code.
*
* @return the org code
*/
@Basic
@Column(name = "ORG_CODE")
@Enumerated(EnumType.STRING)
public OrgCode getOrgCode() {
return orgCode;
}
/**
* @return the status
*/
@Enumerated(EnumType.STRING)
@Column(length = 10)
public KontoStatus getStatus()
{
return status;
}
@ElementCollection(targetClass = Role.class, fetch = FetchType.EAGER)
@CollectionTable(name = "USER_ROLES", joinColumns = @JoinColumn(name = "USER_ID"))
@Enumerated(EnumType.STRING)
@Column(name = "role", nullable = false)
public Set<Role> getRoles() {
return roles;
}
/**
* Gets the vote.
*
* @return the vote
*/
@Basic
@Column(name = "VOTE")
@Enumerated(EnumType.STRING)
public VoteDecision getVote() {
return vote;
}
/**
* Gets the ballot type.
*
* @return the ballot type
*/
@Basic
@Column(name = "BALLOT_TYPE")
@Enumerated(EnumType.STRING)
public BallotType getBallotType() {
return ballotType;
}
/**
* Gets the vote.
*
* @return the vote
*/
@Basic
@Column(name = "VOTE")
@Enumerated(EnumType.STRING)
public VoteDecision getVote() {
return vote;
}
/**
* Gets the concern.
*
* @return the concern
*/
@Basic
@Column(name = "CONCERN")
@Enumerated(EnumType.STRING)
public VoteIssueType getConcern() {
return concern;
}
@Enumerated(EnumType.STRING)
@Column(name = "timesheet_booking_status", length = 20, nullable = false)
public TimesheetBookingStatus getTimesheetBookingStatus()
{
if (timesheetBookingStatus == null) {
return TimesheetBookingStatus.DEFAULT;
} else {
return timesheetBookingStatus;
}
}
/**
* Gets the value.
*
* @return the value
*/
@Basic
@Column(name = "VALUE_")
@Enumerated(EnumType.STRING)
public RegionCategory getValue() {
return value;
}
/**
* Gets the value.
*
* @return the value
*/
@Basic
@Column(name = "VALUE_")
@Enumerated(EnumType.STRING)
public LendingTypeCategory getValue() {
return value;
}
/**
* Gets the gender.
*
* @return the gender
*/
@Basic
@Column(name = "GENDER")
@Enumerated(EnumType.STRING)
public SexType getGender() {
return gender;
}
/**
* Gets the role description.
*
* @return the role description
*/
@Basic
@Column(name = "ROLE_DESCRIPTION")
@Enumerated(EnumType.STRING)
public DocumentPersonReferenceRoleType getRoleDescription() {
return roleDescription;
}
/**
* Gets type of event action. AUDIO or DISPLAY
*
* @return the reminderType
*/
@Enumerated(EnumType.STRING)
@Column(name = "reminder_action_type")
public ReminderActionType getReminderActionType()
{
return reminderActionType;
}
@Enumerated(EnumType.STRING)
@Column(name = "post_type", length = 100, nullable = false)
public PostType getType()
{
return type;
}
/**
* Gets the state.
*
* @return state
*/
@Enumerated(EnumType.STRING)
@Column
public State getState() {
return state;
}
/**
* Gets the type.
*
* @return type
*/
@Column(name = "matcher")
@Enumerated(EnumType.STRING)
public Matcher getMatcher() {
return matcher;
}
@Column(nullable = false)
@Enumerated(EnumType.STRING)
public PaymentMethod getPaymentMethod() {
return paymentMethod;
}
@Enumerated(EnumType.STRING)
@Column(length = 15, name = "contact_type", nullable = false)
public ContactType getContactType()
{
return contactType;
}
@Enumerated(EnumType.STRING)
@Column(length = STATUS_LENGTH)
public TaskStatus getStatus()
{
return status;
}
@Enumerated(EnumType.STRING)
@Column(name = "art", length = 30)
public AuftragsPositionsArt getArt()
{
return art;
}
@Enumerated(EnumType.STRING)
@Column(name = "book_type", length = 20, nullable = true)
public BookType getType()
{
return type;
}
@Enumerated(EnumType.STRING)
@Column(name = "status", length = 30)
public AuftragsStatus getAuftragsStatus()
{
return auftragsStatus;
}
@Enumerated(EnumType.STRING)
@Column(name = "perfil", nullable = false)
public PerfilEnum getPerfil() {
return perfil;
}
/**
* @return the hashType
*/
@Column(name = "hashType", nullable = true)
@Enumerated(EnumType.STRING)
public MCRPasswordHashType getHashType() {
return password == null ? null : password.hashType;
}
@Enumerated(EnumType.STRING)
@Column(name = "form", length = 10)
public FormOfAddress getForm()
{
return form;
}
@Enumerated(EnumType.STRING)
@Column(length = 20)
public ScriptParameterType getParameter6Type()
{
return parameter6Type;
}