本文整理汇总了Java中com.google.api.server.spi.config.AnnotationBoolean类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationBoolean类的具体用法?Java AnnotationBoolean怎么用?Java AnnotationBoolean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationBoolean类属于com.google.api.server.spi.config包,在下文中一共展示了AnnotationBoolean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readApiClass
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
private void readApiClass(ApiClassAnnotationConfig config, Annotation apiClass)
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
config.setResourceIfNotEmpty((String) getAnnotationProperty(apiClass, "resource"));
config.setAuthLevelIfSpecified((AuthLevel) getAnnotationProperty(apiClass, "authLevel"));
config.setScopesIfSpecified((String[]) getAnnotationProperty(apiClass, "scopes"));
config.setAudiencesIfSpecified((String[]) getAnnotationProperty(apiClass, "audiences"));
config.setIssuerAudiencesIfSpecified(getIssuerAudiences(apiClass));
config.setClientIdsIfSpecified((String[]) getAnnotationProperty(apiClass, "clientIds"));
config.setAuthenticatorsIfSpecified(
this.<Class<? extends Authenticator>[]>getAnnotationProperty(apiClass, "authenticators"));
config.setPeerAuthenticatorsIfSpecified(this.<
Class<? extends PeerAuthenticator>[]>getAnnotationProperty(apiClass, "peerAuthenticators"));
config.setUseDatastoreIfSpecified(
(AnnotationBoolean) getAnnotationProperty(apiClass, "useDatastoreForAdditionalConfig"));
config.setApiKeyRequiredIfSpecified(
(AnnotationBoolean) this.getAnnotationProperty(apiClass, "apiKeyRequired"));
}
示例2: readApiMethodInstance
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
private void readApiMethodInstance(ApiMethodAnnotationConfig config, Annotation apiMethod)
throws IllegalArgumentException, SecurityException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
config.setNameIfNotEmpty((String) getAnnotationProperty(apiMethod, "name"));
config.setDescriptionIfNotEmpty((String) getAnnotationProperty(apiMethod, "description"));
config.setPathIfNotEmpty((String) getAnnotationProperty(apiMethod, "path"));
config.setHttpMethodIfNotEmpty((String) getAnnotationProperty(apiMethod, "httpMethod"));
config.setAuthLevelIfSpecified((AuthLevel) getAnnotationProperty(apiMethod, "authLevel"));
config.setScopesIfSpecified((String[]) getAnnotationProperty(apiMethod, "scopes"));
config.setAudiencesIfSpecified((String[]) getAnnotationProperty(apiMethod, "audiences"));
config.setIssuerAudiencesIfSpecified(getIssuerAudiences(apiMethod));
config.setClientIdsIfSpecified((String[]) getAnnotationProperty(apiMethod, "clientIds"));
config.setAuthenticatorsIfSpecified(
this.<Class<? extends Authenticator>[]>getAnnotationProperty(apiMethod, "authenticators"));
config.setPeerAuthenticatorsIfSpecified(this.<
Class<? extends PeerAuthenticator>[]>getAnnotationProperty(apiMethod,
"peerAuthenticators"));
config.setIgnoredIfSpecified((AnnotationBoolean) getAnnotationProperty(apiMethod, "ignored"));
config.setApiKeyRequiredIfSpecified(
(AnnotationBoolean) this.getAnnotationProperty(apiMethod, "apiKeyRequired"));
config.setMetricCosts(
(ApiMetricCost[]) getAnnotationProperty(apiMethod, "metricCosts"));
}
示例3: testValidateMethods_ignoredMethod
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
@Test
public void testValidateMethods_ignoredMethod() throws Exception {
final class Bean {
}
@Api
final class Endpoint {
@ApiMethod(ignored = AnnotationBoolean.TRUE)
public void thisShouldBeIgnored(Bean resource1, Bean resource2) {
}
}
ApiConfig config = configLoader.loadConfiguration(ServiceContext.create(), Endpoint.class);
// If this passes validation, then no error will be thrown. Otherwise, the validator will
// complain that the method has two resources.
validator.validate(config);
}
示例4: testLevelOverridingWithDefaultOverrides
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
@Test
public void testLevelOverridingWithDefaultOverrides() throws Exception {
@Api(
scopes = {"s0c", "s1c"},
audiences = {"a0c", "a1c"},
clientIds = {"c0c", "c1c"},
resource = "resource2",
useDatastoreForAdditionalConfig = AnnotationBoolean.TRUE
)
final class Test extends SimpleLevelOverridingInheritedApi {
}
ApiConfig config = createConfig(Test.class);
annotationReader.loadEndpointClass(serviceContext, Test.class, config);
annotationReader.loadEndpointMethods(serviceContext, Test.class,
config.getApiClassConfig().getMethods());
// All values overridden at a lower level, so nothing should change.
verifySimpleLevelOverriding(config);
}
示例5: initialize
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
@ApiMethod(ignored = AnnotationBoolean.TRUE)
public synchronized void initialize(DiscoveryProvider discoveryProvider) {
if (!initialized) {
this.discoveryProvider = discoveryProvider;
initialized = true;
}
}
示例6: readApi
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
private void readApi(ApiAnnotationConfig config, Annotation api)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
config.setIsAbstractIfSpecified((AnnotationBoolean) getAnnotationProperty(api, "isAbstract"));
config.setRootIfNotEmpty((String) getAnnotationProperty(api, "root"));
config.setNameIfNotEmpty((String) getAnnotationProperty(api, "name"));
config.setCanonicalNameIfNotEmpty((String) getAnnotationProperty(api, "canonicalName"));
config.setVersionIfNotEmpty((String) getAnnotationProperty(api, "version"));
config.setTitleIfNotEmpty((String) getAnnotationProperty(api, "title"));
config.setDescriptionIfNotEmpty((String) getAnnotationProperty(api, "description"));
config.setDocumentationLinkIfNotEmpty((String) getAnnotationProperty(api, "documentationLink"));
config.setIsDefaultVersionIfSpecified(
(AnnotationBoolean) getAnnotationProperty(api, "defaultVersion"));
config.setIsDiscoverableIfSpecified(
(AnnotationBoolean) getAnnotationProperty(api, "discoverable"));
config.setUseDatastoreIfSpecified(
(AnnotationBoolean) getAnnotationProperty(api, "useDatastoreForAdditionalConfig"));
config.setBackendRootIfNotEmpty((String) getAnnotationProperty(api, "backendRoot"));
config.setResourceIfNotEmpty((String) getAnnotationProperty(api, "resource"));
config.setAuthLevelIfSpecified((AuthLevel) getAnnotationProperty(api, "authLevel"));
config.setScopesIfSpecified((String[]) getAnnotationProperty(api, "scopes"));
config.setAudiencesIfSpecified((String[]) getAnnotationProperty(api, "audiences"));
config.setIssuersIfSpecified(getIssuerConfigs(api));
config.setIssuerAudiencesIfSpecified(getIssuerAudiences(api));
config.setClientIdsIfSpecified((String[]) getAnnotationProperty(api, "clientIds"));
config.setAuthenticatorsIfSpecified(
this.<Class<? extends Authenticator>[]>getAnnotationProperty(api, "authenticators"));
config.setPeerAuthenticatorsIfSpecified(this
.<Class<? extends PeerAuthenticator>[]>getAnnotationProperty(api, "peerAuthenticators"));
config.setApiKeyRequiredIfSpecified(
(AnnotationBoolean) this.getAnnotationProperty(api, "apiKeyRequired"));
config.setApiLimitMetrics(
(ApiLimitMetric[]) this.getAnnotationProperty(api, "limitDefinitions"));
}
示例7: readApiAuth
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
/**
* Converts the auth config from the auth annotation. Subclasses may override
* to add additional information to the auth config.
*/
protected void readApiAuth(ApiAuthAnnotationConfig config, Annotation auth)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
config.setAllowCookieAuthIfSpecified(
(AnnotationBoolean) getAnnotationProperty(auth, "allowCookieAuth"));
config.setBlockedRegionsIfNotEmpty((String[]) getAnnotationProperty(auth, "blockedRegions"));
}
示例8: findNameForSerialization
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
@Override
public PropertyName findNameForSerialization(Annotated a) {
ApiResourceProperty apiName = a.getAnnotation(ApiResourceProperty.class);
if (apiName != null && apiName.ignored() != AnnotationBoolean.TRUE) {
return PropertyName.construct(apiName.name());
}
return null;
}
示例9: findNameForDeserialization
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
@Override
public PropertyName findNameForDeserialization(Annotated a) {
ApiResourceProperty apiName = a.getAnnotation(ApiResourceProperty.class);
if (apiName != null && apiName.ignored() != AnnotationBoolean.TRUE) {
return PropertyName.construct(apiName.name());
}
return null;
}
示例10: setIsAbstractIfSpecified
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
public void setIsAbstractIfSpecified(AnnotationBoolean isAbstract) {
if (isAbstract == AnnotationBoolean.TRUE) {
config.setIsAbstract(true);
} else if (isAbstract == AnnotationBoolean.FALSE) {
config.setIsAbstract(false);
}
}
示例11: setIsDefaultVersionIfSpecified
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
public void setIsDefaultVersionIfSpecified(AnnotationBoolean defaultVersion) {
if (defaultVersion == AnnotationBoolean.TRUE) {
config.setIsDefaultVersion(true);
} else if (defaultVersion == AnnotationBoolean.FALSE) {
config.setIsDefaultVersion(false);
}
}
示例12: setIsDiscoverableIfSpecified
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
public void setIsDiscoverableIfSpecified(AnnotationBoolean discoverable) {
if (discoverable == AnnotationBoolean.TRUE) {
config.setIsDiscoverable(true);
} else if (discoverable == AnnotationBoolean.FALSE) {
config.setIsDiscoverable(false);
}
}
示例13: setUseDatastoreIfSpecified
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
public void setUseDatastoreIfSpecified(AnnotationBoolean useDatastore) {
if (useDatastore == AnnotationBoolean.TRUE) {
config.setUseDatastore(true);
} else if (useDatastore == AnnotationBoolean.FALSE) {
config.setUseDatastore(false);
}
}
示例14: setApiKeyRequiredIfSpecified
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
public void setApiKeyRequiredIfSpecified(AnnotationBoolean apiKeyRequired) {
if (apiKeyRequired == AnnotationBoolean.TRUE) {
config.setApiKeyRequired(true);
} else if (apiKeyRequired == AnnotationBoolean.FALSE) {
config.setApiKeyRequired(false);
}
}
示例15: setAllowCookieAuthIfSpecified
import com.google.api.server.spi.config.AnnotationBoolean; //导入依赖的package包/类
public void setAllowCookieAuthIfSpecified(AnnotationBoolean allowCookieAuth) {
if (allowCookieAuth == AnnotationBoolean.TRUE) {
config.setAllowCookieAuth(true);
} else if (allowCookieAuth == AnnotationBoolean.FALSE) {
config.setAllowCookieAuth(false);
}
}