草庐IT

question_type

全部标签

java - JAXB 生成的 xml 中的 "xsi:type"和 "xmlns:xsi"

我使用JAXB创建文件夹和文件层次结构我的模型:@XmlRootElementpublicclassRoot{@XmlAttributeprivateStringpath;@XmlElement(name="dir")privateArrayListrootContentDirs=null;@XmlElement(name="file")privateArrayListrootContentFiles=null;publicvoidsetRootContentDirs(ArrayListrootContentDirs){this.rootContentDirs=rootContentD

java - 错误 : column "id" is of type uuid but expression is of type bytea

我的实体看起来像@EntitypublicclassMember{@IdprivateUUIDid;@Column(name="member_external_id",unique=true,nullable=false)privateStringmemberExternalId;@Column(name="client_id",unique=true,nullable=false)privateStringclientId;@Column(name="client_secret",unique=true,nullable=false)privateStringclientSecret

java - 如何在JavaPoet中添加 'Any Type'问号?

我正在使用JavaPoet生成代码。我想在生成的代码中的某处添加一个具有以下参数的方法。...publicBsomeMethod(finalAbstractObjectBuilderbuilder){...}...所以我的JavaPoet代码应该是这样的//Thisdoesnotcompile,sinceIdon'tknowwhattoputaslastargument(questionmark)ParameterizedTypeNameparameterizedTypeName=ParameterizedTypeName.get(AbstractObjectBuilder.class

java - 错误 : type parameters of <T>T cannot be determined during Maven Install

当我尝试执行“mvninstall”时,这个函数会抛出奇怪的错误publicTget(finalAN_ENUMkey){returnsome_map.get(key);}这是我得到错误的地方finalintvalue=get(AN_ENUM.A_FIELD);这是maven中的错误:XXX.java:[25,41]typeparametersofTcannotbedetermined;nouniquemaximalinstanceexistsfortypevariableTwithupperboundsint,java.lang.Object我已经知道如何“修复它”。我只需要将上一个代

Java编译器错误谜题: "inner classes cannot have static declarations" - except for simple types

在编写代码时,我遇到了一种奇怪的Java编译器行为。当编译类(下面的源代码)时,编译器在NULL类变量上发出错误(“内部类不能有静态声明”)。这符合预期!但是,零类变量不会产生错误。这个我不懂!为什么会有这种差异,它似乎允许在内部类中对简单类型进行静态声明,但不允许对对象进行静态声明。(javac-version:1.6.0_24)publicclassOuter{publicstaticfinalRunnableHELLO=newRunnable(){//NocompilererrorpublicstaticfinalintZERO=0;//Causescompilererror:"

java - “Type mismatch: cannot convert int to byte”

我看到有人问关于错误“类型不匹配:无法将int转换为字节”的问题。但它们大多是由涉及的算术运算引起的。这是我的案例:(当我想在EclipseKepler中玩位时会发生这种情况)//java7binaryliteralsbytea=0b01111111;//8-bititcompilesbyteb=0b10000000;//8-biterror:Typemismatch:cannotconvertinttobyte.bytec=(byte)0b10000000;//8-bititworksfineifcasted.问题是,如果它是8位并且最高位是1,那么编译器会给出错误。我想知道为什么。

java - 组织.postgresql.util.PSQLException : ERROR: value too long for type character varying(255)

当我执行我的项目时,出现以下错误:目标是使用hibernate将json文本保存到数据库中。Users.java&UsersBooks.java同样,Books.java:@Entity@Table(name="tblbooks")publicclassBooks{@Id@Column(name="bookshareId")privateintbookshareId;@Column(name="author")privateStringauthor;@Column(name="availableToDownload")privateintavailableToDownload;@Col

java - 如何在 Java 中创建 Type 5 UUID?

在python中,要生成Type5UUID,我们可以简单地执行以下操作:importuuidprintuuid.uuid5(uuid.NAMESPACE_URL,'mystring')浏览javadocumentationforjava.util.UUID,我不知道该怎么做。首先,没有提到类型5。他们确实有Type3,但签名是:nameUUIDFromBytes(byte[]name)Staticfactorytoretrieveatype3(namebased)UUIDbasedonthespecifiedbytearray.我们如何在Java中创建Type5UUID?

java - Ant 中的 "Failed to create task or type antlib:org.apache.maven.artifact.ant:mvn"错误

在build.xml中运行Ant任务时,Ant构建无法运行。我在控制台中收到以下错误:Buildfile:F:\EclipseProjects\my_project\build.xml[typedef]Couldnotloaddefinitionsfromresourceorg/apache/maven/artifact/ant/antlib.xml.Itcouldnotbefound.BUILDFAILEDF:\my_project\build.xml:32:Problem:failedtocreatetaskortypeantlib:org.apache.maven.artifac

java - Protobuf 错误 :Protocol message tag had invalid wire type

我在尝试用java读取消息时遇到以下错误Exceptioninthread"main"com.google.protobuf.InvalidProtocolBufferException:Protocolmessagetaghadinvalidwiretype.atcom.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:78)atcom.google.protobuf.UnknownFieldSet$Builder.mergeFieldF