本文整理汇总了Java中org.stringtemplate.v4.misc.STNoSuchPropertyException类的典型用法代码示例。如果您正苦于以下问题:Java STNoSuchPropertyException类的具体用法?Java STNoSuchPropertyException怎么用?Java STNoSuchPropertyException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
STNoSuchPropertyException类属于org.stringtemplate.v4.misc包,在下文中一共展示了STNoSuchPropertyException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName)
throws STNoSuchPropertyException
{
JSONObject jo = (JSONObject)o;
Object value;
if (property == null || !jo.has(propertyName))
{
throw new STNoSuchPropertyException(null, null, propertyName);
}
value = jo.get(propertyName);
if (value instanceof JSONArray)
{
value = convertJSONArrayToArray((JSONArray)value);
} else if (value == JSONObject.NULL) {
value = null;
}
return value;
}
示例2: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public synchronized Object getProperty(Interpreter anInter, ST aSt,
Object anObject, Object aProperty, String aName)
throws STNoSuchPropertyException {
Raml oRoot=(Raml)anObject;
if(aName.equals("baseUri")) {
return Resolver.resolve(oRoot.getBaseUri(), oRoot.getBaseUriParameters(), "[BaseUriParameter]");
}
if(aName.equals("cleanVersion")) {
if(oRoot.getVersion()!=null) {
return Utils.cleanString(oRoot.getVersion());
} else {
return null;
}
}
return super.getProperty(anInter, aSt, anObject, aProperty, aName);
}
示例3: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public synchronized Object getProperty(Interpreter anInter, ST aSt,
Object anObject, Object aProperty, String aName)
throws STNoSuchPropertyException {
MimeType oBody=(MimeType)anObject;
if(aName.equals("isSpecific")) {
return !oBody.getType().equals("*/*");
}
if(aName.equals("name")) {
return StringUtils.replaceChars(oBody.getType(), "*/", "s_");
}
if(aName.equals("schemaEscape")) {
return StringEscapeUtils.escapeJava(oBody.getSchema());
}
if(aName.equals("exampleEscape")) {
return StringEscapeUtils.escapeJava(oBody.getExample());
}
if(aName.equals("exampleEscapeJS")) {
return StringEscapeUtils.escapeEcmaScript(oBody.getExample());
}
return super.getProperty(anInter, aSt, anObject, aProperty, aName);
}
示例4: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interpreter, ST self, Object o, Object property, String propertyName)
throws STNoSuchPropertyException {
MapLike mapLike=(MapLike) o;
return mapLike.get(propertyName).orElseNull();
// return super.getProperty(interpreter,self,o,property,propertyName);
}
示例5: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
final Map<?, ?> map = (Map<?, ?>) o;
switch (propertyName) {
case "entrySet":
return map.entrySet();
case "hasSingleValue":
return map.size() == 1;
}
return super.getProperty(interp, self, o, property, propertyName);
}
示例6: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
final SecuritySchemeDescriptor d = (SecuritySchemeDescriptor) o;
switch (propertyName) {
case "queryParameters":
return new TreeMap<>(d.getQueryParameters());
case "headers":
return new TreeMap<>(d.getHeaders());
case "responses":
return new TreeMap<>(d.getResponses());
default:
return super.getProperty(interp, self, o, property, propertyName);
}
}
示例7: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
final Action a = (Action) o;
switch (propertyName) {
case "securitySchemes":
if (a.getSecuredBy() != null && !a.getSecuredBy().isEmpty()) {
return a.getSecuredBy();
}
if (a.getResource().getSecuredBy() != null && !a.getResource().getSecuredBy().isEmpty()) {
return a.getResource().getSecuredBy();
}
if (raml.getSecuredBy() != null && !raml.getSecuredBy().isEmpty()) {
return raml.getSecuredBy();
}
return Collections.emptyList();
case "type":
return a.getType().toString();
case "responses":
return new TreeMap<>(a.getResponses());
case "queryParameters":
return new TreeMap<>(a.getQueryParameters());
case "headers":
return new TreeMap<>(a.getHeaders());
case "body":
return a.getBody() == null ? null : new TreeMap<>(a.getBody());
default:
return super.getProperty(interp, self, o, property, propertyName);
}
}
示例8: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
final Response r = (Response) o;
switch (propertyName) {
case "body":
return r.getBody() == null ? null : new TreeMap<>(r.getBody());
case "headers":
return new TreeMap<>(r.getHeaders());
default:
return super.getProperty(interp, self, o, property, propertyName);
}
}
示例9: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
final Resource res = (Resource) o;
switch (propertyName) {
case "resolvedUriParameters":
final Map<String, UriParameter> params = new TreeMap<>();
getAllResources(res, params);
return params;
case "actions":
return new TreeMap<>(res.getActions());
default:
return super.getProperty(interp, self, o, property, propertyName);
}
}
示例10: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
if ("allResources".equals(propertyName)) {
return getAllResources((Raml) o);
}
return super.getProperty(interp, self, o, property, propertyName);
}
示例11: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public synchronized Object getProperty(Interpreter anInter, ST aSt,
Object anObject, Object aProperty, String aName)
throws STNoSuchPropertyException {
ActionType oType=(ActionType)anObject;
if(aName.equals("validation")) {
return "validation"+oType;
}
return super.getProperty(anInter, aSt, anObject, aProperty, aName);
}
示例12: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public synchronized Object getProperty(Interpreter anInter, ST aSt,
Object anObject, Object aProperty, String aName)
throws STNoSuchPropertyException {
Response oResponse=(Response)anObject;
if(aName.equals("body")) {
if(oResponse.getBody()==null || oResponse.getBody().size()==0) {
Map<String, MimeType> oMap=oResponse.getBody()==null?new HashMap<String, MimeType>():oResponse.getBody();
oMap.put("*/*", new MimeType("*/*"));
oResponse.setBody(oMap);
}
}
return super.getProperty(anInter, aSt, anObject, aProperty, aName);
}
示例13: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public synchronized Object getProperty(Interpreter anInter, ST aSt,
Object anObject, Object aProperty, String aName)
throws STNoSuchPropertyException {
Resource oResource=(Resource)anObject;
if(aName.startsWith("uri")) {
String oUri = oResource.getParentResource()==null?"":(String)getProperty(anInter, aSt, oResource.getParentResource(), aName, aName);
oUri += oResource.getRelativeUri();
if(aName.endsWith("express")) {
oUri=StringUtils.replace(oUri, "{mediaTypeExtension}", "");
oUri=StringUtils.replace(StringUtils.replaceChars(oUri, '{', ':'),"}", "");
}
return oUri;
}
if(aName.equals("methodUri")) {
String oReturn=Utils.cleanString(oResource.getRelativeUri());
for(Resource oR=oResource.getParentResource(); oR!=null; oR=oR.getParentResource()) {
oReturn=Utils.cleanString(oR.getRelativeUri())+"_"+oReturn;
}
return oReturn;
}
if(aName.equals("get")) {
return oResource.getAction(ActionType.GET);
}
if(aName.equals("post")) {
return oResource.getAction(ActionType.POST);
}
if(aName.equals("put")) {
return oResource.getAction(ActionType.PUT);
}
if(aName.equals("delete")) {
return oResource.getAction(ActionType.DELETE);
}
return super.getProperty(anInter, aSt, anObject, aProperty, aName);
}
示例14: userCodeException
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
public String userCodeException(STMessage arg) {
Throwable t = arg.cause;
if (t instanceof STNoSuchPropertyException) {
STNoSuchPropertyException exp = (STNoSuchPropertyException)t;
if (exp.getCause() != null && exp.getCause() instanceof InvocationTargetException) {
InvocationTargetException ite = (InvocationTargetException)exp.getCause();
return "User Code Exception: " + ite.getCause();
}
}
return "<Unknown>";
}
示例15: getProperty
import org.stringtemplate.v4.misc.STNoSuchPropertyException; //导入依赖的package包/类
@Override
public final Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
Preconditions.checkArgument(type.isInstance(o),"instance %s is not of type %s",o,type);
return getProperty((T) o, propertyName);
}