Java 类javax.persistence.EnumType 实例源码

项目:omr    文件:GrupoVO.java   
/**
 * 
 * @return
 */
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "grupo_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
private void getEnumerated(List<Annotation> annotationList, Element element) {
    Element subElement = element != null ? element.element( "enumerated" ) : null;
    if ( subElement != null ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( Enumerated.class );
        String enumerated = subElement.getTextTrim();
        if ( "ORDINAL".equalsIgnoreCase( enumerated ) ) {
            ad.setValue( "value", EnumType.ORDINAL );
        }
        else if ( "STRING".equalsIgnoreCase( enumerated ) ) {
            ad.setValue( "value", EnumType.STRING );
        }
        else if ( StringHelper.isNotEmpty( enumerated ) ) {
            throw new AnnotationException( "Unknown EnumType: " + enumerated + ". " + SCHEMA_VALIDATION );
        }
        annotationList.add( AnnotationFactory.create( ad ) );
    }
}
项目:domui    文件:HibernateChecker.java   
/**
 * Enums must be mapped as String, not ORDINAL.
 * @param g
 */
private void checkEnumMapping(Method g) {
    if(Enum.class.isAssignableFrom(g.getReturnType())) {        // Is type enum?
        if(g.getAnnotation(Transient.class) != null)
            return;

        //-- If the enum has a @Type we will have to assume the type handles mapping correctly (like MappedEnumType)
        org.hibernate.annotations.Type ht = g.getAnnotation(Type.class);
        if(null == ht) {
            //-- No @Type mapping, so this must have proper @Enumerated definition.
            Enumerated e = g.getAnnotation(Enumerated.class);
            if(null == e) {
                problem(Severity.ERROR, "Missing @Enumerated annotation on enum property - this will cause ORDINAL mapping of an enum which is undesirable");
                m_enumErrors++;
            } else if(e.value() != EnumType.STRING) {
                problem(Severity.ERROR, "@Enumerated(ORDINAL) annotation on enum property - this will cause ORDINAL mapping of an enum which is undesirable");
                m_enumErrors++;
            }
        }
    }
}
项目:hibernate-semantic-query    文件:BasicTypeRegistry.java   
public BasicTypeRegistry(TypeConfiguration typeConfiguration) {
    this.typeConfiguration = typeConfiguration;
    this.baseJdbcRecommendedSqlTypeMappingContext = new JdbcRecommendedSqlTypeMappingContext() {
        @Override
        public boolean isNationalized() {
            return false;
        }

        @Override
        public boolean isLob() {
            return false;
        }

        @Override
        public EnumType getEnumeratedType() {
            return EnumType.STRING;
        }

        @Override
        public TypeConfiguration getTypeConfiguration() {
            return typeConfiguration;
        }
    };
    registerBasicTypes();
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
/**
 * 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 ) );
    }
}
项目:holon-datastore-jpa    文件:JpaEnumeratedBeanPropertyPostProcessor.java   
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Builder<?> processBeanProperty(Builder<?> property, Class<?> beanOrNestedClass) {
    property.getAnnotation(Enumerated.class).ifPresent(a -> {
        final EnumType enumType = a.value();
        if (enumType == EnumType.STRING) {
            ((Builder) property).converter(PropertyValueConverter.enumByName());
        } else {
            ((Builder) property).converter(PropertyValueConverter.enumByOrdinal());
        }
        LOGGER.debug(() -> "JpaEnumeratedBeanPropertyPostProcessor: setted property [" + property
                + "] value converter to default enumeration converter using [" + enumType.name() + "] mode");
    });
    return property;
}
项目:oson    文件:Oson.java   
public static EnumType valueOf(ENUM_TYPE en) {
    switch (en) {
        case ORDINAL: return EnumType.ORDINAL;
        case STRING: return EnumType.STRING;
        default: return null;
    }
}
项目:oson    文件:Oson.java   
public EnumType getEnumType() {
    if (enumType == null && classMapper != null) {
        enumType = classMapper.enumType;
    }

    return enumType;
}
项目:oson    文件:BascicDateTypeTest.java   
@Test
    public void testSerializeBasicDateTypeRaw() {
        BascicDateType datetype = new BascicDateType();

        datetype.character = 'A';
        datetype.pdouble = 123.456;
        datetype.pfloat = 3.456f;
        datetype.ddouble = 5.34;
        datetype.dfloat = 89.345f;


        String json = oson.setAppendingFloatingZero(false).setEnumType(EnumType.ORDINAL).setDate2Long(true).serialize(datetype);

        Map<String, Object> map = (Map<String, Object>)oson.getListMapObject(json);

        Field[] fields = oson.getFields(BascicDateType.class);

        for (Field field: fields) {
            String name = field.getName();
//          System.err.println("\n" + field.getName() + ":");
            //System.err.println(field.getType());
            Object obj = map.get(name);
//          System.err.println(obj);

            if (obj != null) {
                //System.err.println(obj.getClass());
                assertTrue(ObjectUtil.isSameDataType(field.getType(), obj.getClass()));
            }
        }
    }
项目:oson    文件:EnumTest.java   
@Test
public void testSerializeEnumWithEnumType() {
 Enum value = MODIFIER.Synchronized;
 String expected = "10";

 oson.setEnumType(EnumType.ORDINAL);

 String result = oson.serialize(value);

 assertEquals(expected, result);
}
项目:myWMS    文件:LogItem.java   
/**
 * Getter for property type.
 * 
 * @return Value of property type.
 */
@Enumerated(EnumType.STRING)
@Column(nullable = false)
public LogItemType getType() {

    return this.type;
}
项目:maven-plugin    文件:GeraEntidade.java   
@Enumerated(EnumType.STRING)
private Attribute createAttribute(String[] parts) {
    Boolean oneToMany = false;
    Boolean oneToOne = false;
    Boolean manyToOne = false;
    Boolean manyToMany = false;
    Boolean required = false;
    Boolean enumString = false;
    Boolean enumOrdinal = false;

    if (parts.length > 2) {
        for (int i = 2; i < parts.length; i++) {
            if (this.isRequired(parts[i])) {
                required = Boolean.valueOf(parts[i]);
            } else if (this.isOneToMany(parts[i])) {
                oneToMany = true;
            } else if (this.isOneToOne(parts[i])) {
                oneToOne = true;
            } else if (this.isManyToOne(parts[i])) {
                manyToOne = true;
            } else if (this.isManyToMany(parts[i])) {
                manyToMany = true;
            } else if (this.isEnumString(parts[i])) {
                enumString = true;
            } else if (this.isEnumOrdinal(parts[i])) {
                enumOrdinal = true;
            }
        }
    }

    return new Attribute(parts[0], parts[1], Util.primeiraMaiuscula(parts[0]), oneToMany, oneToOne, manyToOne, manyToMany, required, enumString, enumOrdinal);
}
项目:omr    文件:GrupoVO.java   
/**
 * 
 * @return
 */
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "grupo_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:omr    文件:PessoaVO.java   
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "pessoa_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:Project-H-Backend    文件:KeyPerformanceIndicatorType.java   
/**
 * @return type type of KPI
 */
@Enumerated(EnumType.ORDINAL)
@Column(name = "type", unique = false, nullable = false)
@Field(index=org.hibernate.search.annotations.Index.TOKENIZED, store=Store.NO)
public Type getType() {
    return this.type;
}
项目:powop    文件:Description.java   
/**
 *
 * @return Return the subjects that this content is about.
 */
@ElementCollection
@Column(name = "type")
@Enumerated(EnumType.STRING)
@Sort(type = SortType.NATURAL)
public SortedSet<DescriptionType> getTypes() {
    return types;
}
项目:omr    文件:PessoaVO.java   
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "pessoa_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:hibernate-semantic-query    文件:EnumJavaDescriptor.java   
@Override
public SqlTypeDescriptor getJdbcRecommendedSqlType(JdbcRecommendedSqlTypeMappingContext context) {
    final int jdbcCode;
    if ( context.getEnumeratedType() != null && context.getEnumeratedType() == EnumType.STRING ) {
        return context.isNationalized()
                ? context.getTypeConfiguration().getSqlTypeDescriptorRegistry().getDescriptor( Types.NVARCHAR )
                : context.getTypeConfiguration().getSqlTypeDescriptorRegistry().getDescriptor( Types.VARCHAR );
    }
    else {
        return context.getTypeConfiguration().getSqlTypeDescriptorRegistry().getDescriptor( Types.INTEGER );
    }
}
项目:omr    文件:PessoaVO.java   
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "pessoa_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:omr    文件:GrupoVO.java   
/**
 * 
 * @return
 */
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "grupo_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:omr    文件:PessoaVO.java   
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "pessoa_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:omr    文件:GrupoVO.java   
/**
 * 
 * @return
 */
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:omr    文件:PessoaVO.java   
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:omr    文件:PessoaVO.java   
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "pessoa_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
    return authorities;
}
项目:aws-photosharing-example    文件:Role.java   
@Id
@Enumerated(EnumType.STRING)    
public com.amazon.photosharing.enums.Role getRole() {return this._role;}
项目:ponto-inteligente-api    文件:Lancamento.java   
@Enumerated(EnumType.STRING)
@Column(name = "tipo", nullable = false)
public TipoEnum getTipo() {
    return tipo;
}
项目:ponto-inteligente-api    文件:Funcionario.java   
@Enumerated(EnumType.STRING)
@Column(name = "perfil", nullable = false)
public PerfilEnum getPerfil() {
    return perfil;
}
项目:appng-examples    文件:Person.java   
@Enumerated(EnumType.STRING)
public Gender getGender() {
    return gender;
}
项目:borabeber-api    文件:Usuario.java   
@Enumerated(EnumType.STRING)
@Column(name = "perfil", nullable = false)
public PerfilEnum getPerfil() {
    return perfil;
}
项目:oson    文件:Oson.java   
public EnumType value() {
    return valueOf(this);
}
项目:oson    文件:Oson.java   
private EnumType getEnumType() {
    return options.getEnumType();
}
项目:oson    文件:Oson.java   
public Oson setEnumType(EnumType enumType) {
    options.setEnumType(enumType);

    return this;
}
项目:oson    文件:Oson.java   
public <T> Oson setEnumType(Class<T> type, EnumType enumType) {
    cMap(type).setEnumType(enumType);

    return this;
}
项目:oson    文件:FieldMapper.java   
public FieldMapper setEnumType(EnumType enumType) {
    this.enumType = enumType;
    return this;
}
项目:oson    文件:Options.java   
public EnumType getEnumType() {
    return enumType;
}
项目:oson    文件:Options.java   
public void setEnumType(EnumType enumType) {
    this.enumType = enumType;
}
项目:oson    文件:ClassMapper.java   
public ClassMapper setEnumType(EnumType enumType) {
    this.enumType = enumType;
    return this;
}
项目:lj-projectbuilder    文件:AttributeEntity.java   
@Enumerated(EnumType.STRING)
@Column(name="TYPE", nullable = false)
public DataType getDataType() {
    return dataType;
}
项目:lj-projectbuilder    文件:CodeTemplateEntity.java   
@Enumerated(EnumType.STRING)
@Column(name="TEMPLATE_TYPE", nullable = false)
public TemplateType getType() {
    return type;
}