本文整理汇总了Java中org.apache.commons.lang3.reflect.FieldUtils.readStaticField方法的典型用法代码示例。如果您正苦于以下问题:Java FieldUtils.readStaticField方法的具体用法?Java FieldUtils.readStaticField怎么用?Java FieldUtils.readStaticField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.reflect.FieldUtils
的用法示例。
在下文中一共展示了FieldUtils.readStaticField方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispose
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
public void dispose()
{
try
{
DragGestureRecognizer recognizer =
(DragGestureRecognizer) FieldUtils.readStaticField
(
TransferHandler.class,
"recognizer",
true
);
if(recognizer != null && recognizer.getComponent() == installedOn)
{
recognizer.setComponent(null);
}
}
catch(IllegalAccessException e)
{
e.printStackTrace();
}
installedOn = null;
folderModel = null;
}
示例2: readStaticFieldOfType
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> T readStaticFieldOfType(Class c, Class<T> t) throws IllegalAccessException
{
for (Field f : FieldUtils.getAllFields(c))
{
if (Modifier.isStatic(f.getModifiers()) && f.getType().equals(t))
{
return (T) FieldUtils.readStaticField(f, true);
}
}
throw new IllegalAccessException();
}
示例3: getPromotableUsers
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
/**
*
* @return a collection of promotable users available to the current account.
* @throws Exception
*/
@SuppressWarnings("rawtypes")
public List<PromotableUser> getPromotableUsers() throws Exception {
String resourceCollection = (String) FieldUtils.readStaticField(PromotableUser.class, "RESOURCE_COLLECTION", true);
String resourcePath = resourceCollection.replace("{account_id}", id);
log.debug("calling twitter endpoint : " + getResource().path(resourcePath).toString());
List<PromotableUser> promotableUsers = getResource().path(resourcePath).accept(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<List<PromotableUser>>() {});
promotableUsers.forEach(p -> p.setAccount_id(id));
return promotableUsers;
}
示例4: getFundingInstruments
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
/**
* @return a collection of funding instruments available to the current
* account.
*/
@SuppressWarnings("rawtypes")
public List<FundingInstrument> getFundingInstruments() throws Exception {
String resourceCollection = (String) FieldUtils.readStaticField(FundingInstrument.class, "RESOURCE_COLLECTION", true);
String resourcePath = resourceCollection.replace("{account_id}", id);
log.debug("calling twitter endpoint : " + getResource().path(resourcePath).toString());
List<FundingInstrument> fundingInstruments = getResource().path(resourcePath).accept(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<List<FundingInstrument>>() {});
fundingInstruments.forEach(f -> f.setAccount_id(id));
return fundingInstruments;
}
示例5: getLineItems
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public List<LineItem> getLineItems() throws Exception {
String resourceCollection = (String) FieldUtils.readStaticField(LineItem.class, "RESOURCE_COLLECTION", true);
String resourcePath = resourceCollection.replace("{account_id}", id);
log.debug("calling twitter endpoint : " + getResource().path(resourcePath).toString());
List<LineItem> lineItems = getResource().path(resourcePath).accept(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<List<LineItem>>() {});
lineItems.forEach(l -> l.setAccount_id(id));
return lineItems;
}
示例6: getAppList
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public List<AppList> getAppList() throws Exception {
String resourceCollection = (String) FieldUtils.readStaticField(AppList.class, "RESOURCE_COLLECTION", true);
String resourcePath = resourceCollection.replace("{account_id}", id);
log.debug("calling twitter endpoint : " + getResource().path(resourcePath).toString());
List<AppList> appLists = getResource().path(resourcePath).accept(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<List<AppList>>() {});
appLists.forEach(a -> a.setAccount_id(id));
return appLists;
}
示例7: getTailoredAudiences
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public List<TailoredAudience> getTailoredAudiences() throws Exception {
String resourceCollection = (String) FieldUtils.readStaticField(TailoredAudience.class, "RESOURCE_COLLECTION", true);
String resourcePath = resourceCollection.replace("{account_id}", id);
log.debug("calling twitter endpoint : " + getResource().path(resourcePath).toString());
List<TailoredAudience> tailoredAudiences = getResource().path(resourcePath).accept(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<List<TailoredAudience>>() {});
tailoredAudiences.forEach(ta -> ta.setAccount_id(id));
return tailoredAudiences;
}
示例8: getVideos
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public List<Video> getVideos() throws Exception {
String resourceCollection = (String) FieldUtils.readStaticField(Video.class, "RESOURCE_COLLECTION", true);
String resourcePath = resourceCollection.replace("{account_id}", id);
log.debug("calling twitter endpoint : " + getResource().path(resourcePath).toString());
List<Video> videos = getResource().path(resourcePath).accept(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<List<Video>>() {});
videos.forEach(v -> v.setAccount_id(id));
return videos;
}
示例9: getTypes
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected Map<String, ? extends BroadleafEnumerationType> getTypes(Class<? extends BroadleafEnumerationType> clazz) {
try {
return (Map<String, ? extends BroadleafEnumerationType>) FieldUtils.readStaticField(clazz, "TYPES", true);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:9,代码来源:AbstractRuleBuilderEnumOptionsExtensionListener.java
示例10: getTypes
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
/**
* Overridden to remove deprecated options
*/
@Override
protected Map<String, ? extends BroadleafEnumerationType> getTypes(Class<? extends BroadleafEnumerationType> clazz) {
try {
Map<String, ? extends BroadleafEnumerationType> options =
(Map<String, ? extends BroadleafEnumerationType>) FieldUtils.readStaticField(clazz, "TYPES", true);
options.remove("NONE");
options.remove("BASIC");
return options;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:17,代码来源:InventoryTypeEnumOptionsExtensionListener.java
示例11: getTypes
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
/**
* Overridden to remove deprecated options
*/
@Override
protected Map<String, ? extends SparkEnumerationType> getTypes(Class<? extends SparkEnumerationType> clazz) {
try {
Map<String, ? extends SparkEnumerationType> options =
(Map<String, ? extends SparkEnumerationType>) FieldUtils.readStaticField(clazz, "TYPES", true);
options.remove("NONE");
options.remove("BASIC");
return options;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
示例12: getTypes
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected Map<String, ? extends SparkEnumerationType> getTypes(Class<? extends SparkEnumerationType> clazz) {
try {
return (Map<String, ? extends SparkEnumerationType>) FieldUtils.readStaticField(clazz, "TYPES", true);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
示例13: readPrivateStatic
import org.apache.commons.lang3.reflect.FieldUtils; //导入方法依赖的package包/类
/**
* Read private static field on given class.
*
* @param klass The class.
* @param name The field name.
* @param <T> Type of returned value.
* @return The field value.
*/
public static <T> T readPrivateStatic(Class<?> klass, String name) {
Field field = FieldUtils.getDeclaredField(klass, name, true);
FieldUtils.removeFinalModifier(field);
try {
@SuppressWarnings("unchecked")
T value = (T) FieldUtils.readStaticField(field, true);
return value;
} catch (IllegalAccessException ex) {
throw new AssertionError(ex);
}
}