• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AutoBean类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createSystemTabItem

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
private TabBarItemComponent createSystemTabItem(EnumSystemTabItemType itemType) {
	TabBarItem tabBarItem = null;
	TabBarItemComponent component = null;
	AutoBean<TabBarItem> TabBarItemBean = AutoBeanService.getInstance().getFactory().tabBarItem();
	tabBarItem = TabBarItemBean.as();
	switch (itemType) {
		case PREVIOUS:
			tabBarItem.setName("<");
			break;
		case NEXT:
			tabBarItem.setName(">");
			break;
	}
	component = new TabBarItemComponent(tabBarItem, itemType);
	// Add handlers as not created by usual mechanism
	if(BrowserUtils.isMobile) {
		systemTabHandlers.add(component.addDomHandler(this, TouchStartEvent.getType()));
		systemTabHandlers.add(component.addDomHandler(this, TouchEndEvent.getType()));
	} else {
		systemTabHandlers.add(component.addDomHandler(this, MouseDownEvent.getType()));
		systemTabHandlers.add(component.addDomHandler(this, MouseUpEvent.getType()));
		systemTabHandlers.add(component.addDomHandler(this, MouseOutEvent.getType()));
	}
	systemTabHandlers.add(component.addHandler(component, TapEvent.getType()));
	return component;
}
 
开发者ID:openremote,项目名称:WebConsole,代码行数:27,代码来源:TabBarComponent.java


示例2: testGetMethod

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/** Tests that a top-level method is parsed as expected. */
public void testGetMethod() {
  RpcApiMethod get = service.getMethods().get("moderator.get");
  assertEquals(ImmutableList.of("https://www.googleapis.com/auth/scopename"), get.getScopes());
  assertEquals(ImmutableList.<String>of(), get.getParameterOrder());

  Schema param = get.getParameters().get("param");
  assertFalse(param.isRequired());
  assertNull(param.getPattern());

  @SuppressWarnings("unchecked")
  AutoBean<RpcApiService> serviceBean = EasyMock.createMock(AutoBean.class);
  EasyMock.expect(serviceBean.as()).andReturn(service).anyTimes();
  EasyMock.replay(serviceBean);

  Schema returnsSchema = ApiServiceWrapper.responseSchema(serviceBean, get);
  assertEquals(Type.OBJECT, returnsSchema.getType());

  Schema status = returnsSchema.getProperties().get("status");
  assertEquals(Type.STRING, status.getType());
}
 
开发者ID:showlowtech,项目名称:google-apis-explorer,代码行数:22,代码来源:RpcApiServiceTest.java


示例3: makePayload

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
@Override
public String makePayload() {
  final RequestData data =
      AbstractRequestContext.this.state.invocations.get(0).getRequestData();

  final AutoBean<JsonRpcRequest> bean = MessageFactoryHolder.FACTORY.jsonRpcRequest();
  final JsonRpcRequest request = bean.as();

  request.setVersion("2.0");
  request.setApiVersion(data.getApiVersion());
  request.setId(payloadId++);

  final Map<String, Splittable> params = new HashMap<>();
  for (final Map.Entry<String, Object> entry : data.getNamedParameters().entrySet()) {
    final Object obj = entry.getValue();
    final Splittable value = this.encode(obj);
    params.put(entry.getKey(), value);
  }
  if (data.getRequestResource() != null) {
    params.put("resource", this.encode(data.getRequestResource()));
  }
  request.setParams(params);
  request.setMethod(data.getOperation());

  return AutoBeanCodex.encode(bean).getPayload();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:27,代码来源:AbstractRequestContext.java


示例4: editProxy

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * Take ownership of a proxy instance and make it editable.
 */
public <T extends BaseProxy> T editProxy(final T object) {
  AutoBean<T> bean = this.checkStreamsNotCrossed(object);
  this.checkLocked();

  @SuppressWarnings("unchecked")
  final AutoBean<T> previouslySeen =
      (AutoBean<T>) this.state.editedProxies.get(BaseProxyCategory.stableId(bean));
  if (previouslySeen != null && !previouslySeen.isFrozen()) {
    /*
     * If we've seen the object before, it might be because it was passed in as a method argument.
     * This does not guarantee its mutability, so check that here before returning the cached
     * object.
     */
    return previouslySeen.as();
  }

  // Create editable copies
  final AutoBean<T> parent = bean;
  bean = this.cloneBeanAndCollections(bean);
  bean.setTag(Constants.PARENT_OBJECT, parent);
  return bean.as();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:26,代码来源:AbstractRequestContext.java


示例5: getSerializedProxyId

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * EntityCodex support.
 */
@Override
public Splittable getSerializedProxyId(final SimpleProxyId<?> stableId) {
  final AutoBean<IdMessage> bean = MessageFactoryHolder.FACTORY.id();
  final IdMessage ref = bean.as();
  ref.setServerId(stableId.getServerId());
  ref.setTypeToken(this.getRequestFactory().getTypeToken(stableId.getProxyClass()));
  if (stableId.isSynthetic()) {
    ref.setStrength(Strength.SYNTHETIC);
    ref.setSyntheticId(stableId.getSyntheticId());
  } else if (stableId.isEphemeral()) {
    ref.setStrength(Strength.EPHEMERAL);
    ref.setClientId(stableId.getClientId());
  }
  return AutoBeanCodex.encode(bean);
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:19,代码来源:AbstractRequestContext.java


示例6: createProxy

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * Creates a new proxy with an assigned ID.
 *
 * @param clazz The proxy type
 * @param id The id to be assigned to the new proxy
 * @param useAppendedContexts if {@code true} use the AutoBeanFactory types associated with any
 *        contexts that have been passed into {@link #append(RequestContext)}. If {@code false},
 *        this method will only create proxy types reachable from the implemented RequestContext
 *        interface.
 * @throws IllegalArgumentException if the requested proxy type cannot be created
 */
protected <T extends BaseProxy> AutoBean<T> createProxy(final Class<T> clazz,
    final SimpleProxyId<T> id, final boolean useAppendedContexts) {
  AutoBean<T> created = null;
  if (useAppendedContexts) {
    for (final AbstractRequestContext ctx : this.state.appendedContexts) {
      created = ctx.getAutoBeanFactory().create(clazz);
      if (created != null) {
        break;
      }
    }
  } else {
    created = this.getAutoBeanFactory().create(clazz);
  }
  if (created != null) {
    created.setTag(STABLE_ID, id);
    return created;
  }
  throw new IllegalArgumentException("Unknown proxy type " + clazz.getName());
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:31,代码来源:AbstractRequestContext.java


示例7: checkStreamsNotCrossed

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * This method checks that a proxy object is either immutable, or already edited by this context.
 */
private <T> AutoBean<T> checkStreamsNotCrossed(final T object) {
  final AutoBean<T> bean = AutoBeanUtils.getAutoBean(object);
  if (bean == null) {
    // Unexpected; some kind of foreign implementation?
    throw new IllegalArgumentException(object.getClass().getName());
  }

  final State otherState = bean.getTag(REQUEST_CONTEXT_STATE);
  if (!bean.isFrozen() && otherState != this.state) {
    /*
     * This means something is way off in the weeds. If a bean is editable, it's supposed to be
     * associated with a RequestContext.
     */
    assert otherState != null : "Unfrozen bean with null RequestContext";

    /*
     * Already editing the object in another context or it would have been in the editing map.
     */
    throw new IllegalArgumentException(
        "Attempting to edit an EntityProxy" + " previously edited by another RequestContext");
  }
  return bean;
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:27,代码来源:AbstractRequestContext.java


示例8: toJsonString

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
public String toJsonString(AutoBean<?> obj) {
	String result = "";
	if (obj != null) {
		result = AutoBeanCodex.encode(obj).getPayload();
	}
	return result;
}
 
开发者ID:openremote,项目名称:WebConsole,代码行数:8,代码来源:AutoBeanService.java


示例9: fromJsonString

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
public <T> AutoBean<T> fromJsonString(Class<T> clazz, String json) {
	AutoBean<T> bean = null;
	if (json != null && !json.equals("")) {
    bean = AutoBeanCodex.decode(factory, clazz, json);
	}
  return bean;
}
 
开发者ID:openremote,项目名称:WebConsole,代码行数:8,代码来源:AutoBeanService.java


示例10: getData

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public AutoBean<?> getData(String dataSource, List<DataValuePairContainer> data) {
	BindingMap map = BindingMap.getBindingMap(dataSource);
	AutoBean<?> bean = null;
	if (map != null) {
		String obj = WebConsole.getConsoleUnit().getLocalDataService().getObjectString(map.getDataSource());
		
		if (obj == null || obj.equals("")) {
			// Look in supplied data
			String dataString = null;
			if (data != null) {
				for (DataValuePairContainer dvpC : data) {
					if (dvpC != null) {
						DataValuePair dvp = dvpC.getDataValuePair();
						if (dvp.getName().equalsIgnoreCase(dataSource)) {
							obj = dvp.getValue();
							break;
						}
					}
				}
			}
		}
		
		if (obj != null && !obj.equals("")) {
			bean = AutoBeanService.getInstance().fromJsonString(map.getClazz(), obj);
		} else {
			bean = AutoBeanService.getInstance().getFactory().create(map.getClazz());
		}
	}
	return bean;
}
 
开发者ID:openremote,项目名称:WebConsole,代码行数:32,代码来源:DataBindingService.java


示例11: showWelcomeMessage

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * Determines if the welcome message should be shown by checking: -
 *  URL parameter
 *  Javascript variable
 *  Local storage
 * @return
 */
public static boolean showWelcomeMessage() {
  boolean showWelcome = true;
  
  String param = Window.Location.getParameter("showWelcome");
  
  if (param == null || (!param.equalsIgnoreCase("true") && !param.equalsIgnoreCase("false"))) {
    param = getShowWelcomeString();
  }

    if (param != null && (param.equalsIgnoreCase("true") || param.equalsIgnoreCase("false"))) {
      showWelcome = Boolean.parseBoolean(param);
    }

    if (showWelcome) {
    // Check local storage
    int version = getBuildVersion();
     
     String welcomeObj = LocalDataServiceImpl.getInstance().getObjectString(EnumDataMap.WELCOME_FLAG.getDataName());
     AutoBean<?> bean = AutoBeanService.getInstance().fromJsonString(EnumDataMap.WELCOME_FLAG.getClazz(), welcomeObj);
     Integer welcomeVersion = -1;
     WelcomeFlag welcomeFlag = null;
     
     if (bean != null) {
       welcomeFlag = (WelcomeFlag)bean.as();
       welcomeVersion = welcomeFlag.getWelcomeVersion() == null ? welcomeVersion : welcomeFlag.getWelcomeVersion();
     }
 
     showWelcome = welcomeVersion < version;
  }
  
  return showWelcome;
}
 
开发者ID:openremote,项目名称:WebConsole,代码行数:40,代码来源:BrowserUtils.java


示例12: testReferenceFollowing

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * Create a chain of schema references and verify that the dereferencing works
 * properly.
 */
@SuppressWarnings("unchecked")
public void testReferenceFollowing() {
  Schema startingPoint = EasyMock.createMock(Schema.class);
  EasyMock.expect(startingPoint.getRef()).andReturn("Interstitial");

  AutoBean<Schema> bean = EasyMock.createMock(AutoBean.class);
  EasyMock.expect(bean.as()).andReturn(startingPoint);

  Schema interstitial = EasyMock.createMock(Schema.class);
  EasyMock.expect(interstitial.getRef()).andReturn("Concrete");

  Schema concrete = EasyMock.createMock(Schema.class);
  EasyMock.expect(concrete.getRef()).andReturn(null);
  EasyMock.expect(concrete.getId()).andReturn("Concrete");

  Map<String, Schema> allSchemas =
      ImmutableMap.of("Interstitial", interstitial, "Concrete", concrete);

  EasyMock.replay(startingPoint, interstitial, concrete, bean);

  Schema dereferenced = Schema.PropertyWrapper.followRefs(bean, allSchemas);

  assertEquals(dereferenced, concrete);
  assertEquals("Concrete", concrete.getId());

  EasyMock.verify(startingPoint, interstitial, concrete, bean);
}
 
开发者ID:showlowtech,项目名称:google-apis-explorer,代码行数:32,代码来源:SchemaTest.java


示例13: mutableForMethod

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * Returns true if this property is mutable (or required) for the method
 * identified by the given method identifier.
 */
public static boolean mutableForMethod(AutoBean<Schema> instance, String methodIdentifier) {
  // Required properties will not be explicitly marked mutable, since
  // mutablility is assumed for required properties.
  return requiredForMethod(instance, methodIdentifier)
      || hasAnnotationForMethod(instance.as(), MUTABLE, methodIdentifier);
}
 
开发者ID:showlowtech,项目名称:google-apis-explorer,代码行数:11,代码来源:Schema.java


示例14: testService

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/** Tests that basic service information is parsed as expected. */
public void testService() {
  assertEquals("moderator", service.getName());
  assertEquals("v1", service.getVersion());
  assertEquals("Moderator API", service.getDescription());
  assertEquals("/rpc", service.getRpcPath());
  assertEquals(3, service.getMethods().keySet().size());

  @SuppressWarnings("unchecked")
  AutoBean<RpcApiService> serviceBean = EasyMock.createMock(AutoBean.class);
  EasyMock.expect(serviceBean.as()).andReturn(service).anyTimes();
  EasyMock.replay(serviceBean);

  assertEquals("/rpc", ApiServiceWrapper.basePath(serviceBean));
}
 
开发者ID:showlowtech,项目名称:google-apis-explorer,代码行数:16,代码来源:RpcApiServiceTest.java


示例15: localName

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * @param instance the bean instance.
 * @return the "local" part of the bean's name.
 */
public static String localName(AutoBean<? extends HasQName> instance) {
    String name = instance.as().getName();
    if (name == null) {
        return null;
    }
    return NameTokens.parseQName(name)[1];
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:12,代码来源:QNameCategory.java


示例16: namespace

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * @param instance the bean instance.
 * @return the "namespace" part of the bean's name.
 */
public static String namespace(AutoBean<? extends HasQName> instance) {
    String name = instance.as().getName();
    if (name == null) {
        return null;
    }
    return NameTokens.parseQName(name)[0];
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:12,代码来源:QNameCategory.java


示例17: processPayload

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
@Override
public void processPayload(final Receiver<Void> receiver, final String payload) {
  final Splittable raw = StringQuoter.split(payload);

  @SuppressWarnings("unchecked")
  final Receiver<Object> callback =
      (Receiver<Object>) AbstractRequestContext.this.state.invocations.get(0).getReceiver();

  if (!raw.isNull("error")) {
    final Splittable error = raw.get("error");
    final ServerFailure failure = new ServerFailure(error.get("message").asString(),
        error.get("code").asString(), payload, true);
    AbstractRequestContext.this.fail(receiver, failure);
    return;
  }

  final Splittable result = raw.get("result");
  @SuppressWarnings("unchecked")
  final Class<BaseProxy> target =
      (Class<BaseProxy>) AbstractRequestContext.this.state.invocations.get(0).getRequestData()
          .getReturnType();

  final SimpleProxyId<BaseProxy> id =
      AbstractRequestContext.this.getRequestFactory().allocateId(target);
  final AutoBean<BaseProxy> bean = AbstractRequestContext.this.createProxy(target, id, true);
  // XXX expose this as a proper API
  ((AbstractAutoBean<?>) bean).setData(result);
  // AutoBeanCodex.decodeInto(result, bean);

  if (callback != null) {
    callback.onSuccess(bean.as());
  }
  if (receiver != null) {
    receiver.onSuccess(null);
  }
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:37,代码来源:AbstractRequestContext.java


示例18: MyConstraintViolation

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
public MyConstraintViolation(final ViolationMessage msg) {
  final AutoBean<? extends BaseProxy> leafProxy = this.findEditedProxy(msg.getLeafBeanId());
  this.leafBean = leafProxy == null ? null : leafProxy.as();
  this.message = msg.getMessage();
  this.messageTemplate = msg.getMessageTemplate();
  this.path = msg.getPath();
  final AutoBean<? extends BaseProxy> rootProxy = this.findEditedProxy(msg.getRootBeanId());
  this.rootBeanClass = rootProxy.getType();
  this.rootBean = rootProxy.as();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:11,代码来源:AbstractRequestContext.java


示例19: findEditedProxy

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
private AutoBean<? extends BaseProxy> findEditedProxy(final IdMessage idMessage) {
  // Support violations for value objects.
  final SimpleProxyId<BaseProxy> rootId = AbstractRequestContext.this.getId(idMessage);

  // The stub is empty, since we don't process any OperationMessages
  final AutoBean<BaseProxy> stub =
      AbstractRequestContext.this.getProxyForReturnPayloadGraph(rootId);

  // So pick up the instance that we just sent to the server
  return AbstractRequestContext.this.state.editedProxies.get(BaseProxyCategory.stableId(stub));
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:12,代码来源:AbstractRequestContext.java


示例20: create

import com.google.web.bindery.autobean.shared.AutoBean; //导入依赖的package包/类
/**
 * Create a new object, with an ephemeral id.
 */
@Override
public <T extends BaseProxy> T create(final Class<T> clazz) {
  this.checkLocked();

  final SimpleProxyId<T> id = this.state.requestFactory.allocateId(clazz);
  final AutoBean<T> created = this.createProxy(clazz, id, false);
  return this.takeOwnership(created);
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:12,代码来源:AbstractRequestContext.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExpectedException类代码示例发布时间:2022-05-22
下一篇:
Java Configuration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap