当前位置: 首页>>代码示例>>Java>>正文


Java Hack类代码示例

本文整理汇总了Java中com.google.gag.annotation.remark.Hack的典型用法代码示例。如果您正苦于以下问题:Java Hack类的具体用法?Java Hack怎么用?Java Hack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Hack类属于com.google.gag.annotation.remark包,在下文中一共展示了Hack类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: login

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@Hack
@SubscribeEvent
public void login(PlayerLoggedInEvent e)
{
	if (e.player.worldObj.isRemote)
       {
           // do nothing on client
           return;
       }


	Collection<BloodStain> outStains = getStains(e.player.dimension);
	System.out.println("SENDING STAIONS: " + outStains.size());
	for (BloodStain stain : outStains)
	{
		PacketManager.sendToPlayer(new PacketCreateStain(stain), e.player);
       }
   }
 
开发者ID:Ubiquitous-Spice,项目名称:ModJam-4,代码行数:19,代码来源:StainManager.java

示例2: dimChange

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@Hack
@Metaphor
@SubscribeEvent
public void dimChange(PlayerChangedDimensionEvent e)
{
       if (e.player.worldObj.isRemote)
       {
           // server only.
           return;
       }

	// old stain remover
	PacketManager.sendToPlayer(new PacketStainRemover(e.fromDim), e.player);

	// send new stains
	Collection<BloodStain> outStains = removeStains(e.toDim);


	for (BloodStain stain : outStains)
	{
		PacketManager.sendToPlayer(new PacketCreateStain(stain), e.player);
	}
}
 
开发者ID:Ubiquitous-Spice,项目名称:ModJam-4,代码行数:24,代码来源:StainManager.java

示例3: defer

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@Hack
@OhNoYouDidnt
private static Optional<Plugin> defer(final ListableBeanFactory factory, final String typeName) {
    return Optional.of(typeName)
            .filter(DefaultPluginResolver::exists)
            .map(throwingFunction(DefaultPluginResolver::forName))
            .map(type -> defer(factory, type));
}
 
开发者ID:zalando-stups,项目名称:put-it-to-rest,代码行数:9,代码来源:DefaultPluginResolver.java

示例4: getConfiguration

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@Hack
private TokenRefresherConfiguration getConfiguration() throws NoSuchFieldException, IllegalAccessException {
    final Class<? extends AccessTokens> type = accessTokens.getClass();
    final Field field = type.getSuperclass().getDeclaredField("configuration");
    field.setAccessible(true);
    return (TokenRefresherConfiguration) field.get(accessTokens);
}
 
开发者ID:zalando-stups,项目名称:put-it-to-rest,代码行数:8,代码来源:AccessTokensCredentialsDirectoryTest.java

示例5: negotiate

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@SneakyThrows(HttpMediaTypeNotAcceptableException.class)
default Optional<MediaType> negotiate(final NativeWebRequest request) {
    final HeaderContentNegotiationStrategy negotiator = new HeaderContentNegotiationStrategy();

    final List<MediaType> mediaTypes = negotiator.resolveMediaTypes(request);

    if (mediaTypes.isEmpty()) {
        return Optional.of(PROBLEM);
    }

    for (final MediaType mediaType : mediaTypes) {
        if (mediaType.includes(APPLICATION_JSON) || mediaType.includes(PROBLEM)) {
            return Optional.of(PROBLEM);
        } else if (mediaType.includes(X_PROBLEM)) {
            return Optional.of(X_PROBLEM);
        }
    }

    @Hack("Accepting application/something+json doesn't make you understand application/problem+json, " +
            "but a lot of clients miss to send it correctly")
    final boolean isNeitherAcceptingJsonNorProblemJsonButSomeVendorSpecificJson =
            mediaTypes.stream().anyMatch(WILDCARD_JSON::includes);

    if (isNeitherAcceptingJsonNorProblemJsonButSomeVendorSpecificJson) {
        return Optional.of(PROBLEM);
    }

    return Optional.empty();
}
 
开发者ID:zalando,项目名称:problem-spring-web,代码行数:30,代码来源:AdviceTrait.java

示例6: validRequestParam

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@RequestMapping(path = "/handler-invalid-param", method = POST)
public void validRequestParam(@RequestBody final UserRequest user) {
    @Hack("I couldn't make Spring throw this implicitly using annotations...")
    @Facepalm
    @OhNoYouDidnt
    final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
    final Set<ConstraintViolation<UserRequest>> violations = validator.validate(user);
    throw new ConstraintViolationException(violations);
}
 
开发者ID:zalando,项目名称:problem-spring-web,代码行数:10,代码来源:ExampleRestController.java

示例7: specificJsonGivesProblem

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@Test
@Hack("This is actually rather shady, but it's most likely what the client actually wants")
public void specificJsonGivesProblem() throws Exception {
    mvc().perform(request(GET, url)
            .accept("application/x.vendor.specific+json"))
            .andExpect(content().contentType(MediaTypes.PROBLEM));
}
 
开发者ID:zalando,项目名称:problem-spring-web,代码行数:8,代码来源:ContentNegotiationTest.java

示例8: extractCharset

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@Hack("MediaType#getCharset is not available prior to Spring 4.3")
@SuppressWarnings("deprecation")
private static Charset extractCharset(final MediaType mediaType) {
    return mediaType.getCharSet();
}
 
开发者ID:zalando,项目名称:riptide,代码行数:6,代码来源:HttpResponseException.java

示例9: getReasonPhrase

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
@Hack("Because several status codes are defined with different reason phrases in Spring and JAX-RS")
private String getReasonPhrase(final Status status) {
    return HttpStatus.valueOf(status.getStatusCode()).getReasonPhrase();
}
 
开发者ID:zalando,项目名称:problem-spring-web,代码行数:5,代码来源:AdviceTraitLoggingTest.java

示例10: set

import com.google.gag.annotation.remark.Hack; //导入依赖的package包/类
/**
 * This is required to workaround missing support for {@link com.fasterxml.jackson.annotation.JsonAnySetter} on
 * constructors annotated with {@link com.fasterxml.jackson.annotation.JsonCreator}.
 *
 * @param key   the custom key
 * @param value the custom value
 * @see <a href="https://github.com/FasterXML/jackson-databind/issues/562">Jackson Issue 562</a>
 */
@Hack
@OhNoYouDidnt
void set(final String key, final Object value) {
    parameters.put(key, value);
}
 
开发者ID:zalando,项目名称:problem,代码行数:14,代码来源:AbstractThrowableProblem.java


注:本文中的com.google.gag.annotation.remark.Hack类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。