我正在使用一种逻辑,但我不知道是否可以做到这一点,我想为此使用注释,所以这是我的代码
public class Hola {
public JSONConverter() {
String message= getClass().getAnnotation(HolaAn.class).getMessage();
}
}
@Target({ElementType.FIELD})
public @interface HolaAn{
String getMessage();
}
public class MessageTest{
@HolaAn(getMessage= "MUNDO")
private Hola hola;
@Test
public void testMessage(){
hola= new Hola();
}
}
Run Code Online (Sandbox Code Playgroud)
但是我有 nullPointerException,我不太清楚如何使用我自己的注释,任何人都可以告诉我这是否可能以及如何做到这一点?
我正在使用新的wordpress插件,但我需要一个常规的expresison的帮助,所以,如果你能帮助,我有这个
a:6:{s:5:"width";s:4:"3000";s:6:"height";s:4:"2100";s:14:"hwstring_small";s:23:"height=\'89\' width=\'128\'";s:4:"file";s:25:"2012/02/sopa_nicearma.jpg";s:5:"sizes";a:3:{s:9:"thumbnail";a:3:{s:4:"file";s:23:"sopa_nicearma-15x10.jpg";s:5:"width";s:2:"15";s:6:"height";s:2:"10";}s:6:"medium";a:3:{s:4:"file";s:25:"sopa_nicearma-300x210.jpg";s:5:"width";s:3:"300";s:6:"height";s:3:"210";}s:5:"large";a:3:{s:4:"file";s:25:"sopa_nicearma-700x490.jpg";s:5:"width";s:3:"700";s:6:"height";s:3:"490";}
}s:10:"image_meta";a:10:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";}}
Run Code Online (Sandbox Code Playgroud)
但我想删除这个
s:9:"thumbnail";a:3:{s:4:"file";s:23:"sopa_nicearma-15x10.jpg";s:5:"width";s:2:"15";s:6:"height";s:2:"10";}
Run Code Online (Sandbox Code Playgroud)
并最终有这个
'a:6:{s:5:"width";s:4:"3000";s:6:"height";s:4:"2100";s:14:"hwstring_small";s:23:"height=\'89\' width=\'128\'";s:4:"file";s:25:"2012/02/sopa_nicearma.jpg";s:5:"sizes";a:3:{s:6:"medium";a:3:{s:4:"file";s:25:"sopa_nicearma-300x210.jpg";s:5:"width";s:3:"300";s:6:"height";s:3:"210";}s:5:"large";a:3:{s:4:"file";s:25:"sopa_nicearma-700x490.jpg";s:5:"width";s:3:"700";s:6:"height";s:3:"490";}
}s:10:"image_meta";a:10:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";}}
Run Code Online (Sandbox Code Playgroud)
所以,最后我要删除,这种删除
链{链"名称图像"链}
我有这个想法
chain { chain "name image " chain}
Run Code Online (Sandbox Code Playgroud)
但是不行,因为我有这个
$var = preg_replace("(.+)\{(.+)(sopa_nicearma\-15x10\.jpg)(.+)\}/", "", $var);
Run Code Online (Sandbox Code Playgroud) 我使用 Restaeasy (java) 创建一项 Rest 服务,该服务必须返回与调用的 URL 相同的 URL,但使用一个新字符串
呼叫服务示例:
Post => mybase/myservice/somewrite 并带有一些 JSON
| 响应 => mybase/myservice/somewrite/123456
所以我想用一种通用逻辑制作mybase/myservice/somewrite url,因为如果我输入String returnURL="mybase/myservice/somewrite";并更改,例如mybase响应的名称将不会很好
我想要这样的东西
someLogicService(JSON);
id=getId();
URL=getContextCallURL();
return URL+\/+id;
Run Code Online (Sandbox Code Playgroud)
但我不知道这是否可以做到,更不知道如何做到
我在Symfony 2中的项目有问题我得到了这个错误
Catchable Fatal Error: Object of class Nicearma\MemesBundle\Entity\Usuario could not be converted to string in C:\wamp\www\24memes\vendor\doctrine-dbal\lib\Doctrine\DBAL\Statement.php line 131
Run Code Online (Sandbox Code Playgroud)
问题是,我试图做一个表格,从UsuarioInfo类,这个类有一个对象Usuario,表单工作正常,但去发送信息我得到消息而我没有找到解决方案,任何人都知道如何解决这个?我有这个文件
registro.html.twig
<div class="usuario">
{{ form_row(form.usuario) }}
</div>
{{ form_rest(form) }}
Run Code Online (Sandbox Code Playgroud)
Usuario.php
namespace Nicearma\MemesBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Nicearma\MemesBundle\Entity\Usuario
*
* @ORM\Table(name="usuario")
* @ORM\Entity(repositoryClass="Nicearma\MemesBundle\Repository\Usuario")
*/
class Usuario implements UserInterface
{
/**
* @var integer $id
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string $nombre
* @Assert\Type(type="String") …Run Code Online (Sandbox Code Playgroud) php ×2
annotations ×1
arrays ×1
doctrine ×1
doctrine-orm ×1
jakarta-ee ×1
java ×1
regex ×1
rest ×1
resteasy ×1
symfony ×1
wordpress ×1