本文整理汇总了Java中org.dynamicloud.api.annotation.Bind类的典型用法代码示例。如果您正苦于以下问题:Java Bind类的具体用法?Java Bind怎么用?Java Bind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Bind类属于org.dynamicloud.api.annotation包,在下文中一共展示了Bind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMethod
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
/**
* This method will find a declared method with annotation Bind.
* If this method did not find a method then will return null
*
* @param r object to use and find the specific method
* @param target bound string to find method.
* @return the specific method.
*/
private static Method getMethod(Object r, String target) {
Method[] methods = r.getClass().getMethods();
for (Method m : methods) {
Bind bind = m.getAnnotation(Bind.class);
if (bind != null && bind.field().equals(target)) {
return m;
}
}
return null;
}
示例2: buildFieldsJSON
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
/**
* Builds a compatible string to update a record.
* This method will find the Bind annotation to get field name and its value form bound object.
*
* @param instance Object where data is extracted
* @return compatible string
*/
public static String buildFieldsJSON(BoundInstance instance) {
JSONObject json = new JSONObject();
Method[] methods = instance.getClass().getMethods();
for (Method m : methods) {
Bind a = m.getAnnotation(Bind.class);
if (a != null) {
String fieldName = a.field();
String methodName = GET + m.getName().replaceAll(SET, StringUtils.EMPTY);
try {
Method getMethod = instance.getClass().getMethod(methodName);
Object result = getMethod.invoke(instance);
if (result instanceof Object[]) {
String array = "";
for (Object o : (Object[]) result) {
if (o != null) {
array += (array.length() == 0 ? "" : ",") + o.toString();
}
}
json.put(fieldName, array);
} else if (result instanceof Date) {
json.put(fieldName, df.format((Date) result));
} else if (result != null) {
json.put(fieldName, result.toString());
}
} catch (Exception e) {
logger.warn(e.getMessage());
}
}
}
return json.toString();
}
示例3: setCount
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
/**
* Sets the count of a query. This method is a helper to fetch the count of logs in Dynamicloud
* @param count count of logs
*/
@Bind(field = "count")
final public void setCount(Long count) {
this.count = count;
}
示例4: setWhen
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
/**
* Sets the time when a log was created.
* @param when date time
*/
@Bind(field = "added_at")
public final void setWhen(Date when) {
this.when = when;
}
示例5: setFinancialModule
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "lonlinemodule")
public void setFinancialModule(String module) {
this.financialModule = module;
}
示例6: setRecordId
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
/**
* Sets a new record id
*
* @param newRid new record id
*/
@Override
@Bind(field = "rid")
public void setRecordId(Number newRid) {
this.id = newRid.longValue();
}
示例7: setDate
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "datefie")
public void setDate(Date date) {
this.date = date;
}
示例8: setRecordId
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Override
@Bind(field = "rid")
public void setRecordId(Number newRid) {
this.rid = newRid;
}
示例9: setUsername
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "username")
public void setUsername(String username) {
this.username = username;
}
示例10: setPassword
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "password")
public void setPassword(String[] password) {
this.password = password;
}
示例11: setEmail
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "email")
public void setEmail(String email) {
this.email = email;
}
示例12: setCountry
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "country")
public void setCountry(String country) {
this.country = country;
}
示例13: setName
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "name")
public void setName(String name) {
this.name = name;
}
示例14: setBirthdat
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "birthdat")
public void setBirthdat(String birthdat) {
this.birthdat = birthdat;
}
示例15: setAuxiliarFile
import org.dynamicloud.api.annotation.Bind; //导入依赖的package包/类
@Bind(field = "fieldtwo")
public void setAuxiliarFile(String auxiliarFile) {
this.auxiliarFile = auxiliarFile;
}